aboutsummaryrefslogtreecommitdiff
path: root/send-pack.c
diff options
context:
space:
mode:
authorCarlos Rica <jasampler@gmail.com>2007-09-05 03:38:24 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-05 11:29:33 -0700
commit3d9f037c60ceae1bd60ee3c861564812a89b05b1 (patch)
tree6bf932b630728e2313ffacd8ef573eb63fdc383e /send-pack.c
parent1e61b7640d09015213dbcae3564fa27ac6a8c151 (diff)
downloadgit-3d9f037c60ceae1bd60ee3c861564812a89b05b1.tar.gz
git-3d9f037c60ceae1bd60ee3c861564812a89b05b1.tar.xz
Function for updating refs.
A function intended to be called from builtins updating refs by locking them before write, specially those that came from scripts using "git update-ref". [jc: with minor fixups] Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/send-pack.c b/send-pack.c
index 9fc8a812f..f74e66a8b 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -307,20 +307,14 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
rs.src = ref->name;
rs.dst = NULL;
if (!remote_find_tracking(remote, &rs)) {
- struct ref_lock *lock;
fprintf(stderr, " Also local %s\n", rs.dst);
if (will_delete_ref) {
if (delete_ref(rs.dst, NULL)) {
error("Failed to delete");
}
- } else {
- lock = lock_any_ref_for_update(rs.dst, NULL, 0);
- if (!lock)
- error("Failed to lock");
- else
- write_ref_sha1(lock, ref->new_sha1,
- "update by push");
- }
+ } else
+ update_ref("update by push", rs.dst,
+ ref->new_sha1, NULL, 0, 0);
free(rs.dst);
}
}