From 89f1d83a22eb6ae0c788b1645a713ce524fbf174 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 5 Sep 2023 16:48:37 +0900 Subject: [PATCH] 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. --- lib/src/git.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/git.rs b/lib/src/git.rs index fcfc3cf7c6..9949e9930f 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -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)?; } }