aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/am.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 6c24d075c2..d4b4b86be9 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1148,6 +1148,21 @@ int cmd_am(int argc, const char **argv, const char *prefix)
die(_("failed to read the index"));
if (am_in_progress(&state)) {
+ /*
+ * Catch user error to feed us patches when there is a session
+ * in progress:
+ *
+ * 1. mbox path(s) are provided on the command-line.
+ * 2. stdin is not a tty: the user is trying to feed us a patch
+ * from standard input. This is somewhat unreliable -- stdin
+ * could be /dev/null for example and the caller did not
+ * intend to feed us a patch but wanted to continue
+ * unattended.
+ */
+ if (argc || (resume == RESUME_FALSE && !isatty(0)))
+ die(_("previous rebase directory %s still exists but mbox given."),
+ state.dir);
+
if (resume == RESUME_FALSE)
resume = RESUME_APPLY;