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 <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sergey Organov committed
May 21, 2021 at 00:46 UTC
e0b16421b17fffa2544eebfcb570fdb766fd0bc4
1 file changed
+13
t/t4013-diff-various.sh
+13
@@ -494,6 +494,19 @@ test_expect_success 'git config log.diffMerges first-parent vs -m' '
494
test_cmp expected actual
495
'
496
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
+
510
test_expect_success 'log -S requires an argument' '
511
test_must_fail git log -S
512
'