summaryrefslogtreecommitdiff
path: root/t/perf/perf-lib.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-06-02 10:33:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-05 02:04:51 (GMT)
commit154ffeecc6b13082b06fab96e5de698d606aa790 (patch)
tree9c81facda781e25e22d63c053a45f0ebc1d83269 /t/perf/perf-lib.sh
parent69e6b9b4f4a91ce90f2c38ed2fa89686f8aff44f (diff)
downloadgit-154ffeecc6b13082b06fab96e5de698d606aa790.zip
git-154ffeecc6b13082b06fab96e5de698d606aa790.tar.gz
git-154ffeecc6b13082b06fab96e5de698d606aa790.tar.bz2
perf: work around the tested repo having an index.lock
When the tested repo has an index.lock file it should be removed. This file may be present if e.g. git-status previously crashed in that repo, and it will make a lot of git commands fail. Let's try harder and remove the lock. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/perf-lib.sh')
-rw-r--r--t/perf/perf-lib.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index b6fc880..b50211b 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -108,7 +108,14 @@ test_perf_create_repo_from () {
cd "$repo" &&
"$MODERN_GIT" init -q &&
test_perf_do_repo_symlink_config_ &&
- mv .git/hooks .git/hooks-disabled 2>/dev/null
+ mv .git/hooks .git/hooks-disabled 2>/dev/null &&
+ if test -f .git/index.lock
+ then
+ # We may be copying a repo that can't run "git
+ # status" due to a locked index. Since we have
+ # a copy it's fine to remove the lock.
+ rm .git/index.lock
+ fi
) || error "failed to copy repository '$source' to '$repo'"
}