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>

Ævar Arnfjörð Bjarmason committed Jun 2, 2017 at 10:33 UTC 154ffeecc6b13082b06fab96e5de698d606aa790
1 file changed +8 -1
t/perf/perf-lib.sh
+8 -1
@@ -108,7 +108,14 @@ test_perf_create_repo_from () {
108 cd "$repo" &&
109 "$MODERN_GIT" init -q &&
110 test_perf_do_repo_symlink_config_ &&
111 - mv .git/hooks .git/hooks-disabled 2>/dev/null
111 + mv .git/hooks .git/hooks-disabled 2>/dev/null &&
112 + if test -f .git/index.lock
113 + then
114 + # We may be copying a repo that can't run "git
115 + # status" due to a locked index. Since we have
116 + # a copy it's fine to remove the lock.
117 + rm .git/index.lock
118 + fi
119 ) || error "failed to copy repository '$source' to '$repo'"
120 }
121