summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/add.c2
-rwxr-xr-xt/t3700-add.sh4
2 files changed, 6 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 58ee3f9..b773b5a 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -484,6 +484,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
if (patch_interactive)
add_interactive = 1;
if (add_interactive) {
+ if (show_only)
+ die(_("--dry-run is incompatible with --interactive/--patch"));
if (pathspec_from_file)
die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
exit(interactive_add(argv + 1, prefix, patch_interactive));
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index dd30114..4086e1e 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -349,6 +349,10 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
test_cmp expect.err actual.err
'
+test_expect_success 'git add --dry-run --interactive should fail' '
+ test_must_fail git add --dry-run --interactive
+'
+
test_expect_success 'git add empty string should fail' '
test_must_fail git add ""
'