Commit Diff


commit - a402709190a0d84fb9b8de98564bc8fee6033683
commit + 8f8646e5e92d5fc7ecc97732100e239380ac5de9
blob - 53d9b4395aed07917845e7e66bfa56163f45d843
blob + d0bace45d8f76abfa251a30f171c1a71a9d76aab
--- include/got_error.h
+++ include/got_error.h
@@ -112,6 +112,7 @@
 #define GOT_ERR_HISTEDIT_BUSY	96
 #define GOT_ERR_HISTEDIT_CMD	97
 #define GOT_ERR_HISTEDIT_PATH	98
+#define GOT_ERR_NO_MERGED_PATHS 99
 
 static const struct got_error {
 	int code;
@@ -224,6 +225,7 @@ static const struct got_error {
 	{ GOT_ERR_HISTEDIT_CMD, "bad histedit command" },
 	{ GOT_ERR_HISTEDIT_PATH, "cannot edit branch history which contains "
 	    "changes outside of this work tree's path prefix" },
+	{ GOT_ERR_NO_MERGED_PATHS, "empty list of merged paths" },
 };
 
 /*
blob - cdff663f385ece6d4196b6e18a30d7ddcb7ab947
blob + b41a123079e68a9fd5ae7da2768b794c15d69403
--- lib/worktree.c
+++ lib/worktree.c
@@ -4012,6 +4012,10 @@ rebase_commit(struct got_object_id **new_commit_id,
 	 */
 	if (merged_paths) {
 		struct got_pathlist_entry *pe;
+		if (TAILQ_EMPTY(merged_paths)) {
+			err = got_error(GOT_ERR_NO_MERGED_PATHS);
+			goto done;
+		}
 		TAILQ_FOREACH(pe, merged_paths, entry) {
 			err = worktree_status(worktree, pe->path, fileindex,
 			    repo, collect_commitables, &cc_arg, NULL, NULL);