Skip to content

Commit d899cf5

Browse files
committed
Merge branch 'maint-1.7.7' into maint
* maint-1.7.7: Git 1.7.7.6 diff-index: enable recursive pathspec matching in unpack_trees Conflicts: GIT-VERSION-GEN
2 parents ab8a780 + 0065343 commit d899cf5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Documentation/RelNotes/1.7.7.6.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Fixes since v1.7.7.5
88
directory when two paths in question are in adjacent directories and
99
the name of the one directory is a prefix of the other.
1010

11+
* A wildcard that matches deeper hierarchy given to the "diff-index" command,
12+
e.g. "git diff-index HEAD -- '*.txt'", incorrectly reported additions of
13+
matching files even when there is no change.
14+
1115
* When producing a "thin pack" (primarily used in bundles and smart
1216
HTTP transfers) out of a fully packed repository, we unnecessarily
1317
avoided sending recent objects as a delta against objects we know

diff-lib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ static int diff_cache(struct rev_info *revs,
469469
opts.src_index = &the_index;
470470
opts.dst_index = NULL;
471471
opts.pathspec = &revs->diffopt.pathspec;
472+
opts.pathspec->recursive = 1;
473+
opts.pathspec->max_depth = -1;
472474

473475
init_tree_desc(&t, tree->buffer, tree->size);
474476
return unpack_trees(1, &t, &opts);

t/t4010-diff-pathspec.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ test_expect_success \
4747
'git diff-index --cached $tree -- path1/ >current &&
4848
compare_diff_raw current expected'
4949

50+
cat >expected <<\EOF
51+
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
52+
EOF
53+
test_expect_success \
54+
'"*file1" should show path1/file1' \
55+
'git diff-index --cached $tree -- "*file1" >current &&
56+
compare_diff_raw current expected'
57+
5058
cat >expected <<\EOF
5159
:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M file0
5260
EOF

0 commit comments

Comments
 (0)