-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'en/object-list-with-pathspec'
* en/object-list-with-pathspec: Add testcases showing how pathspecs are handled with rev-list --objects Make rev-list --objects work together with pathspecs
- Loading branch information
Showing
2 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |