Skip to content

Commit

Permalink
http-push: fail when info/refs exists and is already locked
Browse files Browse the repository at this point in the history
Failing instead of silently not updating remote refs makes the things
clearer for the user when trying to push on a repository while another
person do (or while a dandling locks are waiting for a 10 minutes
timeout).

When silently not updating remote refs, the user does not even know
that git has pushed the objects but leaved the refs as they were
before (e.g. a new bunch of commits on branch "master" is uploaded,
however the branch by itsel still points on the previous head commit).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Grégoire Barbier authored and Junio C Hamano committed Jan 20, 2008
1 parent 9116de5 commit 9bdbaba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions http-push.c
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,11 @@ int main(int argc, char **argv)
info_ref_lock = lock_remote("info/refs", LOCK_TIME);
if (info_ref_lock)
remote->can_update_info_refs = 1;
else {
fprintf(stderr, "Error: cannot lock existing info/refs\n");
rc = 1;
goto cleanup;
}
}
if (remote->has_info_packs)
fetch_indices();
Expand Down

0 comments on commit 9bdbaba

Please sign in to comment.