summaryrefslogtreecommitdiff
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2008-03-24 16:14:52 +0100
committerJunio C Hamano <gitster@pobox.com>2008-03-25 00:34:05 -0700
commit5cc8f372509298d13632d8784bc851a587937550 (patch)
treef05904feb2d9ee3e5f277b77d731644c765a85cf /t/t0001-init.sh
parent76ce946294bd17f350c7c0a3927d8986b73ed480 (diff)
downloadgit-5cc8f372509298d13632d8784bc851a587937550.tar.gz
init: show "Reinit" message even in an (existing) empty repository
Earlier, git-init tested for a valid HEAD ref, but if the repository was empty, there was none. Instead, test for the existence of the file $GIT_DIR/HEAD. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index c015405f12..b0289e397a 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -113,4 +113,21 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
fi
'
+test_expect_success 'reinit' '
+
+ (
+ unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG
+
+ mkdir again &&
+ cd again &&
+ git init >out1 2>err1 &&
+ git init >out2 2>err2
+ ) &&
+ grep "Initialized empty" again/out1 &&
+ grep "Reinitialized existing" again/out2 &&
+ >again/empty &&
+ test_cmp again/empty again/err1 &&
+ test_cmp again/empty again/err2
+'
+
test_done