From 9df247f87ced78e5cf8ce7e00d257a806ce2b744 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 3 Dec 2022 10:06:22 -0800 Subject: [PATCH] git: on import, update record of ref only if it changed There's no need to update our record of the ref if it didn't change. This is just about making it clearer; I doubt it will have measurable performance impact. --- 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 d48349777..92304b9cb 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -109,10 +109,10 @@ pub fn import_refs( new_git_heads.insert(id.clone()); // TODO: Make it configurable which remotes are publishing and update public // heads here. - mut_repo.set_git_ref(full_name.clone(), RefTarget::Normal(id.clone())); let old_target = existing_git_refs.remove(&full_name); let new_target = Some(RefTarget::Normal(id.clone())); if new_target != old_target { + mut_repo.set_git_ref(full_name.clone(), RefTarget::Normal(id.clone())); let commit = store.get_commit(&id).unwrap(); mut_repo.add_head(&commit); changed_git_refs.insert(full_name, (old_target, new_target));