diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-03-25 09:20:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-25 09:20:13 -0700 |
commit | f2cfc9c81ea2fe72ea0ac57d63e71e10e8b0af94 (patch) | |
tree | 44c8dd92e2a2b23796099e16501ec9f5c9fa0620 /t | |
parent | declare 1-bit bitfields to be unsigned (diff) | |
parent | Add testcases showing how pathspecs are handled with rev-list --objects (diff) | |
download | tgif-f2cfc9c81ea2fe72ea0ac57d63e71e10e8b0af94.tar.xz |
Merge branch 'en/object-list-with-pathspec' into 'nd/struct-pathspec'
This is to improve the process_tree() function defined in list-objects.c
* en/object-list-with-pathspec:
Add testcases showing how pathspecs are handled with rev-list --objects
Make rev-list --objects work together with pathspecs
Diffstat (limited to 't')
-rwxr-xr-x | t/t6000-rev-list-misc.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh new file mode 100755 index 0000000000..b10685af4e --- /dev/null +++ b/t/t6000-rev-list-misc.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +test_description='miscellaneous rev-list tests' + +. ./test-lib.sh + +test_expect_success setup ' + echo content1 >wanted_file && + echo content2 >unwanted_file && + git add wanted_file unwanted_file && + git commit -m one +' + +test_expect_success 'rev-list --objects heeds pathspecs' ' + git rev-list --objects HEAD -- wanted_file >output && + grep wanted_file output && + ! grep unwanted_file output +' + +test_expect_success 'rev-list --objects with pathspecs and deeper paths' ' + mkdir foo && + >foo/file && + git add foo/file && + git commit -m two && + + git rev-list --objects HEAD -- foo >output && + grep foo/file output && + + git rev-list --objects HEAD -- foo/file >output && + grep foo/file output && + ! grep unwanted_file output +' + +test_expect_success 'rev-list --objects with pathspecs and copied files' ' + git checkout --orphan junio-testcase && + git rm -rf . && + + mkdir two && + echo frotz >one && + cp one two/three && + git add one two/three && + test_tick && + git commit -m that && + + ONE=$(git rev-parse HEAD:one) + git rev-list --objects HEAD two >output && + grep "$ONE two/three" output && + ! grep one output +' + +test_done |