Update the tracking references only if they were succesfully updated on remote
It fixes the bug where local tracking branches were filled with zeroed SHA-1 if the remote branch was not updated because, for instance, it was not an ancestor of the local (i.e. had other changes). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
Nov 12, 2007 at 22:39 UTC
ed31df312a30d91c288a4b6e3d031de15284405a
1 file changed
+2
-1
send-pack.c
+2
-1
@@ -349,7 +349,8 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
349
350
if (!dry_run && remote && ret == 0) {
351
for (ref = remote_refs; ref; ref = ref->next)
352
- update_tracking_ref(remote, ref);
352
+ if (!is_null_sha1(ref->new_sha1))
353
+ update_tracking_ref(remote, ref);
354
}
355
356
if (!new_refs && ret == 0)