disallow 'got rebase' while a histedit operation is in progress
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/got/got.1 b/got/got.1
index f40d55e..97deeed 100644
--- a/got/got.1
+++ b/got/got.1
@@ -1119,7 +1119,8 @@ If the edited history contains changes to files outside of the work tree's
path prefix, the work tree cannot be used to edit the history of this branch.
.Pp
The
-.Cm got update
+.Cm got update ,
+.Cm got rebase ,
and
.Cm got integrate
commands will refuse to run while a histedit operation is in progress.
diff --git a/got/got.c b/got/got.c
index 29a1cd6..e00e812 100644
--- a/got/got.c
+++ b/got/got.c
@@ -5362,6 +5362,7 @@ cmd_rebase(int argc, char *argv[])
struct got_object_id *branch_head_commit_id = NULL, *yca_id = NULL;
struct got_commit_object *commit = NULL;
int ch, rebase_in_progress = 0, abort_rebase = 0, continue_rebase = 0;
+ int histedit_in_progress = 0;
unsigned char rebase_status = GOT_STATUS_NO_CHANGE;
struct got_object_id_queue commits;
struct got_pathlist_head merged_paths;
@@ -5420,6 +5421,15 @@ cmd_rebase(int argc, char *argv[])
if (error)
goto done;
+ error = got_worktree_histedit_in_progress(&histedit_in_progress,
+ worktree);
+ if (error)
+ goto done;
+ if (histedit_in_progress) {
+ error = got_error(GOT_ERR_HISTEDIT_BUSY);
+ goto done;
+ }
+
error = got_worktree_rebase_in_progress(&rebase_in_progress, worktree);
if (error)
goto done;