mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
git fetch: prune old branch names before adding new ones
This commit is contained in:
parent
b7b3314afe
commit
c0c3f87574
3 changed files with 9 additions and 4 deletions
|
@ -174,6 +174,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
* Fix the output of `jj debug completion --help` by reversing fish and zsh text.
|
* Fix the output of `jj debug completion --help` by reversing fish and zsh text.
|
||||||
|
|
||||||
|
* Fixed edge case in `jj git fetch` when a pruned branch is a prefix of another
|
||||||
|
branch.
|
||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
Thanks to the people who made this release happen!
|
Thanks to the people who made this release happen!
|
||||||
|
|
|
@ -364,10 +364,10 @@ pub fn fetch(
|
||||||
let refspec: &[&str] = &[];
|
let refspec: &[&str] = &[];
|
||||||
tracing::debug!("remote.download");
|
tracing::debug!("remote.download");
|
||||||
remote.download(refspec, Some(&mut fetch_options))?;
|
remote.download(refspec, Some(&mut fetch_options))?;
|
||||||
tracing::debug!("remote.update_tips");
|
|
||||||
remote.update_tips(None, false, git2::AutotagOption::Unspecified, None)?;
|
|
||||||
tracing::debug!("remote.prune");
|
tracing::debug!("remote.prune");
|
||||||
remote.prune(None)?;
|
remote.prune(None)?;
|
||||||
|
tracing::debug!("remote.update_tips");
|
||||||
|
remote.update_tips(None, false, git2::AutotagOption::Unspecified, None)?;
|
||||||
// TODO: We could make it optional to get the default branch since we only care
|
// TODO: We could make it optional to get the default branch since we only care
|
||||||
// about it on clone.
|
// about it on clone.
|
||||||
let mut default_branch = None;
|
let mut default_branch = None;
|
||||||
|
|
|
@ -144,8 +144,10 @@ fn test_git_fetch_prune_before_updating_tips() {
|
||||||
.rename("origin/subname", false)
|
.rename("origin/subname", false)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Exhibit bug: origin will prevent origin/subname from being created
|
test_env.jj_cmd_success(&repo_path, &["git", "fetch"]);
|
||||||
let _ = test_env.jj_cmd_failure(&repo_path, &["git", "fetch"]);
|
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
|
||||||
|
origin/subname: 9f01a0e04879 message
|
||||||
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a remote containing a branch with the same name
|
/// Add a remote containing a branch with the same name
|
||||||
|
|
Loading…
Reference in a new issue