Skip to content

Commit

Permalink
Add testcases showing how pathspecs are handled with rev-list --objects
Browse files Browse the repository at this point in the history
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Elijah Newren authored and Junio C Hamano committed Feb 3, 2011
1 parent cc5fa2f commit a97a96f
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions t/t6000-rev-list-misc.sh
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

0 comments on commit a97a96f

Please sign in to comment.