diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-02-13 15:09:33 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-13 15:09:33 -0800 |
commit | 263830c47b0ddd3440fbc87a841499fe699a50b1 (patch) | |
tree | 4ee0c997ed1f94de2f2f6d36baf25f153242d66e /t | |
parent | 67eb5383dd1dac653855ef0a90364fdc5cfdce6a (diff) | |
parent | 59332d13b2b23840452180368914921bffe9bfbc (diff) | |
download | git-263830c47b0ddd3440fbc87a841499fe699a50b1.tar.gz git-263830c47b0ddd3440fbc87a841499fe699a50b1.tar.xz |
Merge branch 'rs/git-dir-cleanup'
* rs/git-dir-cleanup:
Resurrect "git grep --no-index"
setenv(GIT_DIR) clean-up
Conflicts:
builtin-grep.c
t/t7002-grep.sh
Diffstat (limited to 't')
-rwxr-xr-x | t/t7002-grep.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 0b583cbfc..ebae1522c 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -434,6 +434,58 @@ test_expect_success 'grep -Fi' ' test_cmp expected actual ' +test_expect_success 'outside of git repository' ' + rm -fr non && + mkdir -p non/git/sub && + echo hello >non/git/file1 && + echo world >non/git/sub/file2 && + echo ".*o*" >non/git/.gitignore && + { + echo file1:hello && + echo sub/file2:world + } >non/expect.full && + echo file2:world >non/expect.sub + ( + GIT_CEILING_DIRECTORIES="$(pwd)/non/git" && + export GIT_CEILING_DIRECTORIES && + cd non/git && + test_must_fail git grep o && + git grep --no-index o >../actual.full && + test_cmp ../expect.full ../actual.full + cd sub && + test_must_fail git grep o && + git grep --no-index o >../../actual.sub && + test_cmp ../../expect.sub ../../actual.sub + ) +' + +test_expect_success 'inside git repository but with --no-index' ' + rm -fr is && + mkdir -p is/git/sub && + echo hello >is/git/file1 && + echo world >is/git/sub/file2 && + echo ".*o*" >is/git/.gitignore && + { + echo file1:hello && + echo sub/file2:world + } >is/expect.full && + : >is/expect.empty && + echo file2:world >is/expect.sub + ( + cd is/git && + git init && + test_must_fail git grep o >../actual.full && + test_cmp ../expect.empty ../actual.full && + git grep --no-index o >../actual.full && + test_cmp ../expect.full ../actual.full && + cd sub && + test_must_fail git grep o >../../actual.sub && + test_cmp ../../expect.empty ../../actual.sub && + git grep --no-index o >../../actual.sub && + test_cmp ../../expect.sub ../../actual.sub + ) +' + test_expect_success 'setup double-dash tests' ' cat >double-dash <<EOF && -- |