Re: [PATCH 8/8] tree_entry_interesting(): support negative pathspec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

2010/9/8 Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>:
> +
> +test_expect_success 'diff' '
> +       cat >expected <<-\EOF &&
> +:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d M     one/file
> +:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d M     one/two/file
> +:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 d00491fd7e5bb6fa28c517a0bb32b8b506539d4d M     one/zoo
> +EOF
> +       git diff-tree -r HEAD^ HEAD -- one >result &&
> +       test_cmp expected result
> +'

Having the full mode & sha1sum seems to make the test harder to read
than necessary.  Perhaps you could use printf or git ls-files together
with --name-only to simplify and shorten these a bit?  Example
alternative versions for three of your testcases:

test_expect_success 'diff' '
	git ls-files one >expected &&
	git diff --name-only HEAD^ HEAD -- one >result &&
	test_cmp expected result
'

test_expect_success 'diff one ^one/two' '
	git ls-files one | grep -v one/two >expected &&
	git diff --name-only HEAD^ HEAD -- one ^one/two >result &&
	test_cmp expected result
'

test_expect_success 'diff ^one/two' '
	printf "file\none/file\none/zoo\n" >expected &&
	git diff --name-only HEAD^ HEAD -- ^one/two >result &&
	test_cmp expected result
'

Thoughts?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]