Skip to content

Commit

Permalink
git.rs: create export_some_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Jul 1, 2023
1 parent a09f1a4 commit d904b71
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ pub enum GitExportError {
pub fn export_refs(
mut_repo: &mut MutableRepo,
git_repo: &git2::Repository,
) -> Result<Vec<String>, GitExportError> {
export_some_refs(mut_repo, git_repo, |_| true)
}

pub fn export_some_refs(
mut_repo: &mut MutableRepo,
git_repo: &git2::Repository,
git_ref_filter: impl Fn(&RefName) -> bool,
) -> Result<Vec<String>, GitExportError> {
// First find the changes we want need to make without modifying mut_repo
let mut branches_to_update = BTreeMap::new();
Expand All @@ -347,6 +355,7 @@ pub fn export_refs(
// We *do* need to worry about exporting deletion of remote-tracking branches by `jj
// branch forget`.
)
.filter(git_ref_filter)
.collect();
for jj_known_ref in jj_known_refs {
let (nice_branch_name, new_branch) = match &jj_known_ref {
Expand Down

0 comments on commit d904b71

Please sign in to comment.