perform the check for an empty histedit commit list earlier
diff --git a/got/got.c b/got/got.c
index 4e1dee6..676510c 100644
--- a/got/got.c
+++ b/got/got.c
@@ -6536,6 +6536,11 @@ cmd_histedit(int argc, char *argv[])
if (error)
goto done;
+ if (SIMPLEQ_EMPTY(&commits)) {
+ error = got_error(GOT_ERR_EMPTY_HISTEDIT);
+ goto done;
+ }
+
error = got_worktree_histedit_prepare(&tmp_branch, &branch,
&base_commit_id, &fileindex, worktree, repo);
if (error)