summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-16 19:43:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-16 19:43:29 (GMT)
commite96327c94799460e02b38b242995eab0600ebbd6 (patch)
tree258a6686b3473520de72d6ba6ea215bd3f7620d7 /t
parent30e9940356dc67959877f4b2417da33ebdefbb79 (diff)
parent5c20398699165a91af2d81ea2d20385bc8dd3627 (diff)
downloadgit-e96327c94799460e02b38b242995eab0600ebbd6.zip
git-e96327c94799460e02b38b242995eab0600ebbd6.tar.gz
git-e96327c94799460e02b38b242995eab0600ebbd6.tar.bz2
Merge branch 'es/outside-repo-errmsg-hints'
An earlier update to show the location of working tree in the error message did not consider the possibility that a git command may be run in a bare repository, which has been corrected. * es/outside-repo-errmsg-hints: prefix_path: show gitdir if worktree unavailable
Diffstat (limited to 't')
-rwxr-xr-xt/t6136-pathspec-in-bare.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t6136-pathspec-in-bare.sh b/t/t6136-pathspec-in-bare.sh
new file mode 100755
index 0000000..b117251
--- /dev/null
+++ b/t/t6136-pathspec-in-bare.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='diagnosing out-of-scope pathspec'
+
+. ./test-lib.sh
+
+test_expect_success 'setup a bare and non-bare repository' '
+ test_commit file1 &&
+ git clone --bare . bare
+'
+
+test_expect_success 'log and ls-files in a bare repository' '
+ (
+ cd bare &&
+ test_must_fail git log -- .. >out 2>err &&
+ test_must_be_empty out &&
+ test_i18ngrep "outside repository" err &&
+
+ test_must_fail git ls-files -- .. >out 2>err &&
+ test_must_be_empty out &&
+ test_i18ngrep "outside repository" err
+ )
+'
+
+test_expect_success 'log and ls-files in .git directory' '
+ (
+ cd .git &&
+ test_must_fail git log -- .. >out 2>err &&
+ test_must_be_empty out &&
+ test_i18ngrep "outside repository" err &&
+
+ test_must_fail git ls-files -- .. >out 2>err &&
+ test_must_be_empty out &&
+ test_i18ngrep "outside repository" err
+ )
+'
+
+test_done