summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-05-22 12:41:55 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-05-22 12:41:55 -0700
commitfb257bfa174b00e236ac5d6f4282a487f10a9e98 (patch)
tree616da2c04e2140fe22bd4cfaf7f3b9b764d769c3 /t
parentMerge branch 'jk/add-e-kill-editor' (diff)
parentlock_packed_refs(): allow retries when acquiring the packed-refs lock (diff)
downloadtgif-fb257bfa174b00e236ac5d6f4282a487f10a9e98.tar.xz
Merge branch 'mh/lockfile-retry'
Instead of dying immediately upon failing to obtain a lock, retry after a short while with backoff. * mh/lockfile-retry: lock_packed_refs(): allow retries when acquiring the packed-refs lock lockfile: allow file locking to be retried with a timeout
Diffstat (limited to 't')
-rwxr-xr-xt/t3210-pack-refs.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index aa9eb3a3e5..8aae98d482 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -187,4 +187,21 @@ test_expect_success 'notice d/f conflict with existing ref' '
test_must_fail git branch foo/bar/baz/lots/of/extra/components
'
+test_expect_success 'timeout if packed-refs.lock exists' '
+ LOCK=.git/packed-refs.lock &&
+ >"$LOCK" &&
+ test_when_finished "rm -f $LOCK" &&
+ test_must_fail git pack-refs --all --prune
+'
+
+test_expect_success 'retry acquiring packed-refs.lock' '
+ LOCK=.git/packed-refs.lock &&
+ >"$LOCK" &&
+ test_when_finished "wait; rm -f $LOCK" &&
+ {
+ ( sleep 1 ; rm -f $LOCK ) &
+ } &&
+ git -c core.packedrefstimeout=3000 pack-refs --all --prune
+'
+
test_done