don't error out if rebase sees no merged paths; elide the commit instead
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/include/got_error.h b/include/got_error.h
index dd38ef5..8438cb9 100644
--- a/include/got_error.h
+++ b/include/got_error.h
@@ -113,7 +113,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
+/* 99 is currently unused */
#define GOT_ERR_COMMIT_BRANCH 100
#define GOT_ERR_FILE_STAGED 101
#define GOT_ERR_STAGE_NO_CHANGE 102
@@ -253,7 +253,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" },
+ { 99, "unused error code" },
{ GOT_ERR_COMMIT_BRANCH, "will not commit to a branch outside the "
"\"refs/heads/\" reference namespace" },
{ GOT_ERR_FILE_STAGED, "file is staged" },
diff --git a/lib/worktree.c b/lib/worktree.c
index f430566..b4197e4 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -5187,10 +5187,6 @@ 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, 0,