diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-03-17 15:02:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-17 15:02:20 -0700 |
commit | 758d0773baa3732bc62838070566513df6a84239 (patch) | |
tree | aeb0c9d951ced7858d3238bf5a41f59dfb831e01 /t | |
parent | Merge branch 'js/builtin-add-i-cmds' into maint (diff) | |
parent | prefix_path: show gitdir if worktree unavailable (diff) | |
download | tgif-758d0773baa3732bc62838070566513df6a84239.tar.xz |
Merge branch 'es/outside-repo-errmsg-hints' into maint
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
prefix_path: show gitdir when arg is outside repo
Diffstat (limited to 't')
-rwxr-xr-x | t/t6136-pathspec-in-bare.sh | 38 |
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 0000000000..b117251366 --- /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 |