Commit c5996fffdf906ace91b9ec3e51dcb23eb806e187

Stefan Sperling 2020-01-29T12:47:13

perform the check for an empty histedit commit list earlier

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)