diff options
-rw-r--r-- | builtin/am.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c index a02c84ea8f..47dd4c7ddf 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1530,6 +1530,23 @@ int cmd_am(int argc, const char **argv, const char *prefix) struct argv_array paths = ARGV_ARRAY_INIT; int i; + /* + * Handle stray state directory in the independent-run case. In + * the --rebasing case, it is up to the caller to take care of + * stray directories. + */ + if (file_exists(state.dir) && !state.rebasing) { + if (resume == RESUME_ABORT) { + am_destroy(&state); + am_state_release(&state); + return 0; + } + + die(_("Stray %s directory found.\n" + "Use \"git am --abort\" to remove it."), + state.dir); + } + if (resume) die(_("Resolve operation not in progress, we are not resuming.")); |