aboutsummaryrefslogtreecommitdiffstats
path: root/t/t4017-diff-retval.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4017-diff-retval.sh')
-rwxr-xr-xt/t4017-diff-retval.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index f439f469bd..d644310e22 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -143,4 +143,41 @@ test_expect_success 'option errors are not confused by --exit-code' '
grep '^usage:' err
'
+for option in --exit-code --quiet
+do
+ test_expect_success "git diff $option returns 1 for copied file" "
+ git reset --hard &&
+ cp a copy &&
+ git add copy &&
+ test_expect_code 1 git diff $option --cached --find-copies-harder
+ "
+
+ test_expect_success "git diff $option returns 1 for renamed file" "
+ git reset --hard &&
+ git mv a renamed &&
+ test_expect_code 1 git diff $option --cached
+ "
+done
+
+test_expect_success 'setup dirty subrepo' '
+ git reset --hard &&
+ test_create_repo subrepo &&
+ test_commit -C subrepo subrepo-file &&
+ test_tick &&
+ git add subrepo &&
+ git commit -m subrepo &&
+ test_commit -C subrepo another-subrepo-file
+'
+
+for option in --exit-code --quiet
+do
+ for submodule_format in diff log short
+ do
+ opts="$option --submodule=$submodule_format" &&
+ test_expect_success "git diff $opts returns 1 for dirty subrepo" "
+ test_expect_code 1 git diff $opts
+ "
+ done
+done
+
test_done