Skip to content

Commit

Permalink
Only call dump_ref_updates when leaving the remote helper
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Nov 10, 2023
1 parent c9bc672 commit 0653006
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/cinnabar-fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ static void init(void)
atexit(locked_rollback);
}

extern void dump_ref_updates(void);

static void cleanup(void)
{
if (!initialized)
Expand All @@ -182,7 +180,6 @@ static void cleanup(void)
NULL);
commit_shallow_file(the_repository, &shallow_lock);
}
dump_ref_updates();
}

unkeep_all_packs();
Expand Down
4 changes: 0 additions & 4 deletions src/cinnabar-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,6 @@ unsigned int replace_map_tablesize(void)

extern void init_metadata(struct commit *c);

void dump_ref_updates(void);

extern void reset_changeset_heads(void);
extern void reset_manifest_heads(void);

Expand All @@ -485,8 +483,6 @@ void do_reload(struct object_id *oid)
done_cinnabar();
hashmap_init(&git_tree_cache, oid_map_entry_cmp, NULL, 0);

dump_ref_updates();

reset_replace_map();
if (oid) {
if (!is_null_oid(oid)) {
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ extern "C" {
static REF_UPDATES: Lazy<Mutex<HashMap<Box<BStr>, CommitId>>> =
Lazy::new(|| Mutex::new(HashMap::new()));

#[no_mangle]
unsafe extern "C" fn dump_ref_updates() {
fn dump_ref_updates() {
let mut transaction = RefTransaction::new().unwrap();
for (refname, oid) in REF_UPDATES.lock().unwrap().drain() {
let refname = OsStr::from_bytes(&refname);
Expand Down Expand Up @@ -4579,6 +4578,8 @@ fn git_remote_hg(remote: OsString, mut url: OsString) -> Result<c_int, String> {
_ => panic!("unknown command: {}", cmd.as_bstr()),
}
}
// See comment in remote_helper_tags_list.
dump_ref_updates();
Ok(0)
}

Expand Down

0 comments on commit 0653006

Please sign in to comment.