summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/commit.c3
-rwxr-xr-xt/t7526-commit-pathspec-file.sh6
2 files changed, 9 insertions, 0 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index e48c1fd90a..aa1332308a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -347,6 +347,9 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
if (interactive)
die(_("--pathspec-from-file is incompatible with --interactive/--patch"));
+ if (all)
+ die(_("--pathspec-from-file with -a does not make sense"));
+
if (pathspec.nr)
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh
index a06b683534..4b58901ed6 100755
--- a/t/t7526-commit-pathspec-file.sh
+++ b/t/t7526-commit-pathspec-file.sh
@@ -127,4 +127,10 @@ test_expect_success 'only touches what was listed' '
verify_expect
'
+test_expect_success '--pathspec-from-file and --all cannot be used together' '
+ restore_checkpoint &&
+ test_must_fail git commit --pathspec-from-file=- --all -m "Commit" 2>err &&
+ test_i18ngrep "[-]-pathspec-from-file with -a does not make sense" err
+'
+
test_done