Fixes requesting a directory containing another directory with
[brackets] in its name
disable_pathspec_match(true) sets the GIT_DIFF_DISABLE_PATHSPEC_MATCH
flag on libgit2's diff options. Normally, pathspecs are matched using
fnmatch/glob pattern matching, where [ starts a character class, *
and ? are wildcards, and \ is the escape character. With this flag,
pathspecs are treated as literal strings with prefix matching for
directories. So src/[something] matches exactly src/[something] and
any files under it, rather than [something] being interpreted as a
glob character class matching a single character from the set s, o,
m, e, etc.
Removing escaped_name is OK because the old escaped_name doubled
backslashes(\ -> \\) specifically because pathspecs used glob/fnmatch
interpretation, where \ is the escape character. The doubling made
pathspec where \ is the escape character. The doubling made
pathspec treat \\ as "match a literal \". With
disable_pathspec_match(true), there's no glob interpretation at all,
so \ is already treated literally. The doubling is no longer needed
and would actually break things (pathspec would look for \\ instead
of \).
Regarding Windows, escaped_name has no impact on Windows behavior.
On Windows, \ is the path separator and cannot appear in filenames,
so escaped_name was effectively a no-op on Windows anyway. The
existing test for backslash filenames (special/faux\path) is
already gated with `#[cfg(not(windows))]` since such filenames
only exist on Unix. So removing escaped_name has no impact on Windows
behavior.
Bump the release of the crates to reflect the changes in the licensing.
Note that there are no change in the semantics of the libraries, as
checked via `cargo-semverchecks`.
With Rust 1.89.0, there was introduction to the mismatched lifetime
syntax lint[^1].
The suggestion is to use implicit lifetimes via `<'_>`, however, to
maintain the MSRV, the lifetimes are made explicit here by introducing
an (or using the existing) `'a` lifetime.
[^1]: https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint
Find and apply the MSRV, `rust-version = "1.78.0"` to the
`radicle-git` crates.
While applying this change, use the workspace values to clean up
repetition.
The main dependant of `radicle-git`, and its crates, is [`heartwood`].
It is licensed under MIT or Apache-2.0, which has been incompatible with the GPL-3.0 license.
Since the intellectual property of this code base is with the Better Internet Foundation, it was
decided to re-license code in this repository to make the upstream repository compatible.
- Remove the license headers (and instructions to add them)
- Add MIT and Apache-2.0 licenses
- Remove the GPL-3.0 license
- Change the license declarations in the `Cargo.toml` files
[`heartwood`]: https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Updating `radicle-git-ref-core` with update to `Namespaced` logic,
releasing the crate at version `0.5.0`.
This requires bumps to:
- `radicle-git-ref-macro-0.5.0`
- `radicle-git-ext-0.10.0`
- `radicle-surf-0.25.0`
The [manual page](man:gitnamespaces(7)) says:
> Git supports dividing the refs of a single repository into
> multiple namespaces, each of which has its own branches,
> tags, and `HEAD`.
Here, the mention of `HEAD` implies that requiring all
namespaced to start with
refs/namespaces/*/refs
is too strict, as there are legal namespaced refs such as
refs/namespaces/*/HEAD
which are not captured. Relax the corresponding condition, change
documentation and add a test to avoid regression.
The computation for getting the last commit that touched a `Tree` can be
expensive. This is avoided when constructing the `Tree` and is moved to a method
on the `Tree` and `Entry`, aptly named `last_commit`.
`Tree::commit` is kept, however, it now refers to the `Commit` that was used
when constructing the `Tree`. This is required to calculate the last commit. It
was also necessary to add the path of the `Tree`.
For adding `Entry::last_commit`, it was necessary to add the path of the
`Entry`. Incidentally, this can be useful for consumers, since just the `name`
would mean that they would have to manually construct the full path.
The deny tooling removed many of the keys that were in the `deny.toml`.
The auditing of the repository reported that `proc-macro-error` is
unmaintained ([RUSTSEC-2024-0370]). This is replaced with the fork, `proc-macro-error2`,
which is a drop-in replacement.
It also produced a vulnerability report ([RUSTSEC-2024-0421]) for the
`idna` crate, a transitive dependency of `url`. This is fixed by
pinning `url` to `>= 2.5.4`
[RUSTSEC-2024-0370]: https://rustsec.org/advisories/RUSTSEC-2024-0370
[RUSTSEC-2024-0421]: https://rustsec.org/advisories/RUSTSEC-2024-0421
It also pins `url` to be `>= 2.5.4`, since
The `base64` dependency is only required with the `serde`
feature. Move the import of `Engine` into the implentation sites.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Some elements of the `QaulifiedPattern` and `NamespacedPattern` API
were missing:
- `From` implementations
- `Display` implementations
- `Serialize` and `Deserialize` implementations
- `qualified_pattern` macro
This also requires bumping versions:
- `git-ref-format`: 0.3.1
- `git-ref-core`: 0.3.1
- `git-ref-format-macro`: 0.3.1
- `radicle-git-ext`: 0.8.1
- `radicle-surf`: 0.22.1
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This allows us to parse time values on their own.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Iterates over the git2::Diff entries to force libgit2 to do the binary detection.
Also toggles the `skip_binary_check` in the `DiffOptions`.
All this to workaround the libgit2 lazy flag setting[^0]
[^0]: https://github.com/libgit2/libgit2/issues/6637
The formatting no longer needs nightly and only uses stable features.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
To keep the sorting of diffs that is provided by git we should change
the way we serialize them and avoid putting them into separate
modification specific properties.
Add the Nix flake machinery for developing using Nix tooling.
This requires that the following are added:
- Cargo.lock
- rust-toolchain
To ensure that versions are pinned.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Two of the tests in radicle-git-ext and radicle-surf relied on using
the Git repository itself. This can end up being an issue when
sandboxing is involved.
This improves the situation by being able to generate commit data to
add to a temporary repository.
It also adds a helper for creating a local, temporary submodule for
testing the submodule interactions in the radicle-surf API.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The formatting configuration is not worth the maintenance of a nightly
version. Remove it and allow the default formatting to be used
instead.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Removing the Nix tooling managed by niv in favour of a future
`flake.nix`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Git [submodules] are encoded as commits when walking a Git tree. To
allow the support of them in `radicle-surf`, the tree entry is checked
for this case. The entry will be treated such that it is has a name,
prefix, Oid, and the submodule's URL.
It's important to note that the Oid is not usable within the context
of the repository that is being browsed, since they are entirely
separate.
Instead, the URL should be used in conjunction with the Oid for
browsing purposes outside of `radicle-surf`. However, in a future
iteration it may be considered to be able to browse the local contents
of the submodule, if possible.
N.b. getting the submodule and its URL is not supported for a bare
repository, since it will complain about not having a working tree.
[submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Run `niv update` to get the latest Rust toolchain.
This required applying some clippy improvements:
- Removing unnecessary re-export of Oid in `stats` module.
- Replace `get(0)` with `first`
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Update git2 version to 0.18.1 and provide an updated release version
of radicle-git-ext 0.7.0 and radicle-surf 0.18.0.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett