radicle-link: refactor glob

This patch changes the glob module in a couple of ways, outlined
below.

The first change is the use of PatternString in the constructor
functions. This removes the fallibility of the constructors. This
meant that the tests changed to use the `pattern!` macro instead.

The second change is splitting out the `Glob<Branch>` methods into
`Glob<Local>` and `Glob<Remote>`. This means that the local and remote
globs can be constructed separately, and are then combined via the
`branches` and `and` methods.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-11-24 12:38:28 +00:00
parent b173483fa9
commit d7b5186d8c
7 changed files with 268 additions and 112 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ pub fn commit<R: git::Revision>(repo: &Repository, rev: R) -> Result<Commit, Err
}
let branches = repo
.revision_branches(&sha1, Glob::heads("*")?.and_remotes("*")?)?
.revision_branches(&sha1, Glob::all_heads().branches().and(Glob::all_remotes()))?
.into_iter()
.map(|b| b.refname().into())
.collect();