Commit a698f62e1bd91bd51649d4d59a2a1dbddf871d2b

Stefan Sperling 2019-07-25T15:20:32

allow 'got commit' while 'got histedit' is interrupted

diff --git a/got/got.1 b/got/got.1
index 6bfe01e..2c291f5 100644
--- a/got/got.1
+++ b/got/got.1
@@ -703,7 +703,7 @@ character are ignored entirely.
 The available commands are as follows:
 .Bl -column YXZ pick-commit
 .It pick Ar commit Ta Use the specified commit as it is.
-.It edit Ar commit Ta Use the specfified commit but once changes have been
+.It edit Ar commit Ta Use the specified commit but once changes have been
 merged into the work tree interrupt the histedit operation for amending.
 .It fold Ar commit Ta Combine the specified commit with the next commit
 listed further below that will be used.
@@ -758,11 +758,11 @@ path prefix, the work tree cannot be used to edit the history of this branch.
 .Pp
 The
 .Cm got update
-and
+command will refuse to run while a histedit operation is in progress.
+Other commands which manipulate the work tree may be used, and the
 .Cm got commit
-commands will refuse to run while a histedit operation is in progress.
-Other commands which manipulate the work tree may be used for
-conflict resolution purposes.
+command may be used to commit arbitrary changes to the temporary branch
+while the histedit operation is interrupted.
 .Pp
 The options for
 .Cm got histedit
diff --git a/got/got.c b/got/got.c
index 809cd0f..88bc0e3 100644
--- a/got/got.c
+++ b/got/got.c
@@ -3176,7 +3176,7 @@ cmd_commit(int argc, char *argv[])
 	const char *got_author = getenv("GOT_AUTHOR");
 	struct collect_commit_logmsg_arg cl_arg;
 	char *editor = NULL;
-	int ch;
+	int ch, rebase_in_progress;
 
 	while ((ch = getopt(argc, argv, "m:")) != -1) {
 		switch (ch) {
@@ -3222,9 +3222,13 @@ cmd_commit(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	error = check_rebase_or_histedit_in_progress(worktree);
+	error = got_worktree_rebase_in_progress(&rebase_in_progress, worktree);
 	if (error)
 		goto done;
+	if (rebase_in_progress) {
+		error = got_error(GOT_ERR_REBASING);
+		goto done;
+	}
 
 	error = got_repo_open(&repo, got_worktree_get_repo_path(worktree));
 	if (error != NULL)