Commit ff6aa2066572b63f8a0e3a8df060f9b2baceca38

Stefan Sperling 2019-07-25T15:25:52

if histedit has commits to edit, provide a hint in error message

diff --git a/got/got.c b/got/got.c
index 88bc0e3..4cbbcf1 100644
--- a/got/got.c
+++ b/got/got.c
@@ -4669,7 +4669,8 @@ histedit_check_script(struct got_histedit_list *histedit_cmds,
 	char *id_str;
 
 	if (TAILQ_EMPTY(histedit_cmds))
-		return got_error(GOT_ERR_EMPTY_HISTEDIT);
+		return got_error_msg(GOT_ERR_EMPTY_HISTEDIT,
+		    "histedit script contains no commands");
 
 	SIMPLEQ_FOREACH(qid, commits, entry) {
 		TAILQ_FOREACH(hle, histedit_cmds, entry) {
diff --git a/include/got_error.h b/include/got_error.h
index d0bace4..37595c5 100644
--- a/include/got_error.h
+++ b/include/got_error.h
@@ -215,7 +215,8 @@ static const struct got_error {
 	{ GOT_ERR_REBASE_PATH,	"cannot rebase branch which contains "
 	    "changes outside of this work tree's path prefix" },
 	{ GOT_ERR_NOT_HISTEDIT,	"histedit operation not in progress" },
-	{ GOT_ERR_EMPTY_HISTEDIT,"no commits to edit" },
+	{ GOT_ERR_EMPTY_HISTEDIT,"no commits to edit; perhaps the work tree "
+	    "must be updated to an older commit first" },
 	{ GOT_ERR_NO_HISTEDIT_CMD,"no histedit commands provided" },
 	{ GOT_ERR_HISTEDIT_SYNTAX,"syntax error in histedit command list" },
 	{ GOT_ERR_HISTEDIT_CANCEL,"histedit operation cancelled" },