mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
add: die if both --dry-run and --interactive are given
The interactive machinery does not obey --dry-run. Die appropriately if both flags are passed. Signed-off-by: Øystein Walle <oystwa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7e39198978
commit
a1989cf7b8
|
@ -459,6 +459,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||||
if (patch_interactive)
|
if (patch_interactive)
|
||||||
add_interactive = 1;
|
add_interactive = 1;
|
||||||
if (add_interactive) {
|
if (add_interactive) {
|
||||||
|
if (show_only)
|
||||||
|
die(_("--dry-run is incompatible with --interactive/--patch"));
|
||||||
if (pathspec_from_file)
|
if (pathspec_from_file)
|
||||||
die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
|
die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
|
||||||
exit(interactive_add(argv + 1, prefix, patch_interactive));
|
exit(interactive_add(argv + 1, prefix, patch_interactive));
|
||||||
|
|
|
@ -343,6 +343,10 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
|
||||||
test_cmp expect.err actual.err
|
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_expect_success 'git add empty string should fail' '
|
||||||
test_must_fail git add ""
|
test_must_fail git add ""
|
||||||
'
|
'
|
||||||
|
|
Loading…
Reference in a new issue