git: do not export new ref if racy process created one with the same name

Since we've checked the ref doesn't exist in this code path, I think it's
better to not overwrite the existing ref.
This commit is contained in:
Yuya Nishihara 2023-09-05 16:48:37 +09:00
parent a4dd598e3e
commit 89f1d83a22

View file

@ -603,7 +603,7 @@ fn update_git_ref(
} else {
// The branch was added in jj but still doesn't exist in git, so add it
git_repo
.reference(git_ref_name, new_oid, true, "export from jj")
.reference(git_ref_name, new_oid, false, "export from jj")
.map_err(FailedRefExportReason::FailedToSet)?;
}
}