]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1509: make "setup" test more robust
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 21 Nov 2022 03:00:20 +0000 (03:00 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Dec 2022 01:41:58 +0000 (10:41 +0900)
One of the t1509 setup tests is very particular about the output it
expects from `git init`, and fails if the output differs even slightly
which can happen easily if the script is run multiple times since it
doesn't do a good job of cleaning up after itself (i.e. it leaves
detritus in the root directory `/`). One bit of cruft in particular
(`/HEAD`) makes the test fail since its presence causes `git init` to
alter its output; rather than reporting "Initialized empty Git
repository", it instead reports "Reinitialized existing Git repository"
when `/HEAD` is present. Address this problem by making the test do a
more careful job of crafting its intended initial state.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
t/t1509-root-work-tree.sh

index eb57fe7e19fd3d2f5544fd35546e8deca58ce068..d041762628087748ba1b9e56602a8e43b6a6cdae 100755 (executable)
@@ -243,7 +243,7 @@ say "auto bare gitdir"
 # DESTROYYYYY!!!!!
 test_expect_success 'setup' '
        rm -rf /refs /objects /info /hooks &&
-       rm -f /expected /ls.expected /me /result &&
+       rm -f /HEAD /expected /ls.expected /me /result &&
        cd / &&
        echo "Initialized empty Git repository in /" > expected &&
        git init --bare > result &&