From 403d3b498120d65c25b9e40f7327b07b08e26417 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 10 Nov 2023 11:16:38 +0900 Subject: [PATCH] Replace refs/cinnabar/replace literals with REPLACE_REFS_PREFIX --- src/store.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/store.rs b/src/store.rs index ed264e438..6ecf787e3 100644 --- a/src/store.rs +++ b/src/store.rs @@ -1993,7 +1993,13 @@ pub fn merge_metadata(git_url: Url, hg_url: Option, branch: Option<&[u8]>) let cid = item.inner().oid.try_into().unwrap(); if RawCommit::read(cid).is_none() { if let Some(refname) = by_sha1.get(&cid) { - let replace_ref = bstr::join(b"/", [b"refs/cinnabar/replace", &**item.path()]); + let replace_ref = bstr::join( + b"/", + [ + REPLACE_REFS_PREFIX.strip_suffix('/').unwrap().as_bytes(), + &**item.path(), + ], + ); needed.push( bstr::join(b":", [&**refname, replace_ref.as_bstr()]) .as_bstr() @@ -2146,7 +2152,7 @@ pub unsafe extern "C" fn init_metadata(c: *const commit) { } if replace_map_tablesize() == 0 { let mut count = 0; - for_each_ref_in("refs/cinnabar/replace/", |_, _| -> Result<(), ()> { + for_each_ref_in(REPLACE_REFS_PREFIX, |_, _| -> Result<(), ()> { count += 1; Ok(()) })