ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: when colocated with Git, export refs on snapshot

This fixes the bug described in the previous commit.

Because we now print the message about failed exports also while
snapshotting, we may end up reporting it twice on one command. I'm not
sure it's worth worrying about that. We can deal with that later if it
turns out to be a common complaint.
This commit is contained in:
Martin von Zweigbergk 2022-12-08 20:04:33 -08:00 committed by Martin von Zweigbergk
parent 217883591b
commit 2a1c2e05ba
3 changed files with 10 additions and 2 deletions

View file

@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed bugs
* When sharing the working copy with a Git repo, we used to forget to export
branches to Git when only the working copy had changed. That's now fixed.
### Contributors
Thanks to the people who made this release happen!

View file

@ -743,6 +743,12 @@ impl WorkspaceCommandHelper {
)?;
}
if self.working_copy_shared_with_git {
let git_repo = self.repo.store().git_repo().unwrap();
let failed_branches = git::export_refs(mut_repo, &git_repo)?;
print_failed_git_export(ui, &failed_branches)?;
}
self.repo = tx.commit();
}
locked_wc.finish(self.repo.op_id().clone());

View file

@ -120,13 +120,12 @@ fn test_git_colocated_export_branches_on_snapshot() {
@ fab22d1acf5bb9c5aa48cb2c3dd2132072a359ca foo
o 0000000000000000000000000000000000000000
"###);
// TODO: The branch should point to the modified commit
insta::assert_snapshot!(git_repo
.find_reference("refs/heads/foo")
.unwrap()
.target()
.unwrap()
.to_string(), @"438471f3fbf1004298d8fb01eeb13663a051a643");
.to_string(), @"fab22d1acf5bb9c5aa48cb2c3dd2132072a359ca");
}
#[test]