t6120: test for describe with a bare repository
authorSebastian Staudt <koraktor@gmail.com>
Sun, 3 Feb 2019 06:00:25 +0000 (07:00 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Feb 2019 18:27:57 +0000 (10:27 -0800)
This ensures that nothing breaks the basic functionality of describe for
bare repositories. Please note that --broken and --dirty need a working
tree.

Signed-off-by: Sebastian Staudt <koraktor@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6120-describe.sh
index 7da57db17d8003824459c925369e26872c7e7567..1b8690a7c992e13173fda9d6a45bd36c2d286cce 100755 (executable)
@@ -144,6 +144,12 @@ test_expect_success 'rename tag Q back to A' '
 test_expect_success 'pack tag refs' 'git pack-refs'
 check_describe A-* HEAD
 
+test_expect_success 'describe works from outside repo using --git-dir' '
+       git clone --bare "$TRASH_DIRECTORY" "$TRASH_DIRECTORY/bare" &&
+       git --git-dir "$TRASH_DIRECTORY/bare" describe >out &&
+       grep "^A-[1-9][0-9]\?-g[0-9a-f]\+$" out
+'
+
 check_describe "A-*[0-9a-f]" --dirty
 
 test_expect_success 'describe --dirty with --work-tree' '