summaryrefslogtreecommitdiff
path: root/t/t4053-diff-no-index.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4053-diff-no-index.sh')
-rwxr-xr-xt/t4053-diff-no-index.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 01db9243ab..69599279e9 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -26,6 +26,23 @@ test_expect_success 'git diff --no-index directories' '
test_line_count = 14 cnt
'
+test_expect_success 'git diff --no-index with -' '
+ cat >expect <<-\EOF &&
+ diff --git a/- b/-
+ new file mode 100644
+ --- /dev/null
+ +++ b/-
+ @@ -0,0 +1 @@
+ +frotz
+ EOF
+ (
+ cd a &&
+ echo frotz |
+ test_expect_code 1 git diff --no-index /dev/null - >../actual
+ ) &&
+ test_cmp expect actual
+'
+
test_expect_success 'git diff --no-index relative path outside repo' '
(
cd repo &&
@@ -322,6 +339,22 @@ test_expect_success 'diff --no-index with pathspec' '
test_cmp expect actual
'
+test_expect_success 'diff --no-index first path ending in slash with pathspec' '
+ test_expect_code 1 git diff --name-status --no-index a/ b 1 >actual &&
+ cat >expect <<-EOF &&
+ D a/1
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'diff --no-index second path ending in slash with pathspec' '
+ test_expect_code 1 git diff --name-status --no-index a b/ 1 >actual &&
+ cat >expect <<-EOF &&
+ D a/1
+ EOF
+ test_cmp expect actual
+'
+
test_expect_success 'diff --no-index with pathspec no matches' '
test_expect_code 0 git diff --name-status --no-index a b missing
'