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 <gitster@pobox.com>
Grégoire Barbier committed
Jan 19, 2008 at 16:22 UTC
9bdbabade4303bb76d8115cb12470d229d7249e2
1 file changed
+5
http-push.c
+5
@@ -2243,6 +2243,11 @@ int main(int argc, char **argv)
2243
info_ref_lock = lock_remote("info/refs", LOCK_TIME);
2244
if (info_ref_lock)
2245
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
+ }
2251
}
2252
if (remote->has_info_packs)
2253
fetch_indices();