Skip to content

Commit e0b1642

Browse files
sorganovgitster
authored andcommitted
t4013: test "git diff-index -m"
-m in "git diff-index" means "match missing", that differs from its meaning in "git diff". Let's check it in diff-index. Signed-off-by: Sergey Organov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3ae7fe2 commit e0b1642

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t4013-diff-various.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '
494494
test_cmp expected actual
495495
'
496496

497+
# -m in "git diff-index" means "match missing", that differs
498+
# from its meaning in "git diff". Let's check it in diff-index.
499+
# The line in the output for removed file should disappear when
500+
# we provide -m in diff-index.
501+
test_expect_success 'git diff-index -m' '
502+
rm -f file1 &&
503+
git diff-index HEAD >without-m &&
504+
lines_count=$(wc -l <without-m) &&
505+
git diff-index -m HEAD >with-m &&
506+
git restore file1 &&
507+
test_line_count = $((lines_count - 1)) with-m
508+
'
509+
497510
test_expect_success 'log -S requires an argument' '
498511
test_must_fail git log -S
499512
'

0 commit comments

Comments
 (0)