Message ID | CA+xP2SZ6RJj3Eii-=D6eSfkqHFtyskSvUFU=Qg358eTd+-SeNQ@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] Add tests for describe with --work-tree | expand |
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index d639d94696..9a6bd1541f 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -28,6 +28,24 @@ check_describe () { ' } +check_describe_worktree () { + cd "$TEST_DIRECTORY" + expect="$1" + shift + R=$(git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe "$@" 2>err.actual) + S=$? + cat err.actual >&3 + test_expect_success "describe with --work-tree $*" ' + test $S = 0 && + case "$R" in + $expect) echo happy ;; + *) echo "Oops - $R is not $expect"; + false ;; + esac + ' + cd "$TRASH_DIRECTORY" +} + test_expect_success setup '
The dirty ones are already passing, but just because describe is comparing with the wrong working tree. Signed-off-by: Sebastian Staudt <koraktor@gmail.com> --- t/t6120-describe.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) test_tick && @@ -145,14 +163,20 @@ check_describe A-* HEAD check_describe "A-*[0-9a-f]" --dirty +check_describe_worktree "A-*[0-9a-f]" --dirty + test_expect_success 'set-up dirty work tree' ' echo >>file ' check_describe "A-*[0-9a-f]-dirty" --dirty +check_describe_worktree "A-*[0-9a-f]-dirty" --dirty + check_describe "A-*[0-9a-f].mod" --dirty=.mod +check_describe_worktree "A-*[0-9a-f].mod" --dirty=.mod + test_expect_success 'describe --dirty HEAD' ' test_must_fail git describe --dirty HEAD ' -- 2.20.1