builtin rebase: stop if `git am` is in progress
authorPratik Karki <predatoramigo@gmail.com>
Wed, 8 Aug 2018 15:06:22 +0000 (20:51 +0545)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Sep 2018 18:55:58 +0000 (11:55 -0700)
This commit checks for the file `applying` used by `git am` in
`rebase-apply/` and if the file is present it means `git am` is in
progress so it errors out.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
index 9238757443832d2ec4b50edead00e1d7ac03ac10..2165656ae24a872a5faebc9fcac470aa933a194d 100644 (file)
@@ -539,6 +539,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
        git_config(rebase_config, &options);
 
+       strbuf_reset(&buf);
+       strbuf_addf(&buf, "%s/applying", apply_dir());
+       if(file_exists(buf.buf))
+               die(_("It looks like 'git am' is in progress. Cannot rebase."));
+
        if (is_directory(apply_dir())) {
                options.type = REBASE_AM;
                options.state_dir = apply_dir();