mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-28 21:50:27 +08:00
radicle-surf: Namespace using RefString
A `Namespace` is a '/' separated list of components, where each component represents another level of the namespaces hierarchy. Notice that a `RefString` is also a '/' separated list of components, thus it could be reused to define a `Namespace`. This change uses this observation and reworks `Namespace` to be backed by a `RefString`. This naturally leads to defining its helper functions to return `Namespaced` and `NamespacedPattern` reference names. They are reworked to take a `Qualified` for regular reference names and `QualifiedPattern` for refspec names, respectively. This leads to changing the backing vector of `Glob` to use `QualifiedPattern` instead of `PatternString`. While changing `Glob`, it was also noticed that the PhantomData was not used correctly -- all `impl`s used a generic parameter. This was changed to use the `Namespace`, `Tag`, and `Branch` types directly, providing the type-safety that would be expected. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -194,7 +194,7 @@ pub fn commit<R: git::Revision>(repo: &RepositoryRef, rev: R) -> Result<Commit,
|
||||
}
|
||||
|
||||
let branches = repo
|
||||
.revision_branches(&sha1, &Glob::heads("*")?.and_remotes("*")?)?
|
||||
.revision_branches(&sha1, Glob::heads("*")?.and_remotes("*")?)?
|
||||
.into_iter()
|
||||
.map(|b| b.refname().into())
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user