diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2014-01-24 14:40:33 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-24 23:37:19 +0100 |
commit | ae8d0824217bdf97c69ead49568cd03fc140627b (patch) | |
tree | c188d3275e08dd074476d03a8656981dbd5ef643 /t/t4010-diff-pathspec.sh | |
parent | match_pathspec: match pathspec "foo/" against directory "foo" (diff) | |
download | git-ae8d0824217bdf97c69ead49568cd03fc140627b.tar.xz git-ae8d0824217bdf97c69ead49568cd03fc140627b.zip |
pathspec: pass directory indicator to match_pathspec_item()
This patch activates the DO_MATCH_DIRECTORY code in m_p_i(), which
makes "git diff HEAD submodule/" and "git diff HEAD submodule" produce
the same output. Previously only the version without trailing slash
returns the difference (if any).
That's the effect of new ce_path_match(). dir_path_match() is not
executed by the new tests. And it should not introduce regressions.
Previously if path "dir/" is passed in with pathspec "dir/", they
obviously match. With new dir_path_match(), the path becomes
_directory_ "dir" vs pathspec "dir/", which is not executed by the old
code path in m_p_i(). The new code path is executed and produces the
same result.
The other case is pathspec "dir" and path "dir/" is now turned to
"dir" (with DO_MATCH_DIRECTORY). Still the same result before or after
the patch.
So why change? Because of the next patch about clean.c.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4010-diff-pathspec.sh')
-rwxr-xr-x | t/t4010-diff-pathspec.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 15a491295e..d30ff34be7 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -127,4 +127,10 @@ test_expect_success 'diff-tree ignores trailing slash on submodule path' ' test_cmp expect actual ' +test_expect_success 'diff-cache ignores trailing slash on submodule path' ' + git diff --name-only HEAD^ submod >expect && + git diff --name-only HEAD^ submod/ >actual && + test_cmp expect actual +' + test_done |