Skip to content

Commit ff0cb70

Browse files
committed
Merge branch 'am/pathspec-from-file'
An earlier series to teach "--pathspec-from-file" to "git commit" forgot to make the option incompatible with "--all", which has been corrected. * am/pathspec-from-file: commit: forbid --pathspec-from-file --all
2 parents 12029dc + 509efef commit ff0cb70

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

builtin/commit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
347347
if (interactive)
348348
die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
349349

350+
if (all)
351+
die(_("--pathspec-from-file with -a does not make sense"));
352+
350353
if (pathspec.nr)
351354
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
352355

t/t7526-commit-pathspec-file.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,10 @@ test_expect_success 'only touches what was listed' '
127127
verify_expect
128128
'
129129

130+
test_expect_success '--pathspec-from-file and --all cannot be used together' '
131+
restore_checkpoint &&
132+
test_must_fail git commit --pathspec-from-file=- --all -m "Commit" 2>err &&
133+
test_i18ngrep "[-]-pathspec-from-file with -a does not make sense" err
134+
'
135+
130136
test_done

0 commit comments

Comments
 (0)