Skip to content

Commit 9bdbaba

Browse files
Grégoire Barbiergitster
authored andcommitted
http-push: fail when info/refs exists and is already locked
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 <[email protected]>
1 parent 9116de5 commit 9bdbaba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

http-push.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,11 @@ int main(int argc, char **argv)
22432243
info_ref_lock = lock_remote("info/refs", LOCK_TIME);
22442244
if (info_ref_lock)
22452245
remote->can_update_info_refs = 1;
2246+
else {
2247+
fprintf(stderr, "Error: cannot lock existing info/refs\n");
2248+
rc = 1;
2249+
goto cleanup;
2250+
}
22462251
}
22472252
if (remote->has_info_packs)
22482253
fetch_indices();

0 commit comments

Comments
 (0)