summaryrefslogtreecommitdiff
path: root/t/t4038-diff-combined.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4038-diff-combined.sh')
-rwxr-xr-xt/t4038-diff-combined.sh36
1 files changed, 35 insertions, 1 deletions
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 1019d7b..0b4f7df 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -94,7 +94,7 @@ test_expect_success 'setup for --cc --raw' '
blob=$(echo file | git hash-object --stdin -w) &&
base_tree=$(echo "100644 blob $blob file" | git mktree) &&
trees= &&
- for i in `test_seq 1 40`
+ for i in $(test_seq 1 40)
do
blob=$(echo file$i | git hash-object --stdin -w) &&
trees="$trees$(echo "100644 blob $blob file" | git mktree)$LF"
@@ -401,4 +401,38 @@ test_expect_success 'combine diff missing delete bug' '
compare_diff_patch expected actual
'
+test_expect_success 'combine diff gets tree sorting right' '
+ # create a directory and a file that sort differently in trees
+ # versus byte-wise (implied "/" sorts after ".")
+ git checkout -f master &&
+ mkdir foo &&
+ echo base >foo/one &&
+ echo base >foo/two &&
+ echo base >foo.ext &&
+ git add foo foo.ext &&
+ git commit -m base &&
+
+ # one side modifies a file in the directory, along with the root
+ # file...
+ echo master >foo/one &&
+ echo master >foo.ext &&
+ git commit -a -m master &&
+
+ # the other side modifies the other file in the directory
+ git checkout -b other HEAD^ &&
+ echo other >foo/two &&
+ git commit -a -m other &&
+
+ # And now we merge. The files in the subdirectory will resolve cleanly,
+ # meaning that a combined diff will not find them interesting. But it
+ # will find the tree itself interesting, because it had to be merged.
+ git checkout master &&
+ git merge other &&
+
+ printf "MM\tfoo\n" >expect &&
+ git diff-tree -c --name-status -t HEAD >actual.tmp &&
+ sed 1d <actual.tmp >actual &&
+ test_cmp expect actual
+'
+
test_done