From 48c4985e341d05590a6504abab258b732e2c4b64 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 13 Jan 2024 13:19:24 +0900 Subject: [PATCH] git_backend: ensure that no-gc ref target never conflicts --- lib/src/git_backend.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index ab67e8aec..4da11d515 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -594,7 +594,7 @@ fn prevent_gc(git_repo: &gix::Repository, id: &CommitId) -> Result<(), BackendEr fn to_no_gc_ref_update(id: &CommitId) -> gix::refs::transaction::RefEdit { let name = format!("{NO_GC_REF_NAMESPACE}{}", id.hex()); let new = gix::refs::Target::Peeled(validate_git_object_id(id).unwrap()); - let expected = gix::refs::transaction::PreviousValue::Any; + let expected = gix::refs::transaction::PreviousValue::ExistingMustMatch(new.clone()); gix::refs::transaction::RefEdit { change: gix::refs::transaction::Change::Update { log: gix::refs::transaction::LogChange {