Skip to content

Commit a9b5955

Browse files
ossilatorgitster
authored andcommitted
sequencer: rectify empty hint in call of require_clean_work_tree()
The canonical way to represent "no error hint" is making it NULL, which shortcuts the error() call altogether. This fixes the output by removing the line which said just "error:", which would appear when the worktree is dirtied while editing the initial rebase todo file. This was introduced by 97e1873 (rebase -i: rewrite complete_action() in C, 2018-08-28), which did a somewhat inaccurate conversion from shell. To avoid that such bugs re-appear, test for the condition in require_clean_work_tree(). Signed-off-by: Oswald Buddenhagen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb7d80e commit a9b5955

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6172,7 +6172,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
61726172
if (checkout_onto(r, opts, onto_name, &oid, orig_head))
61736173
goto cleanup;
61746174

6175-
if (require_clean_work_tree(r, "rebase", "", 1, 1))
6175+
if (require_clean_work_tree(r, "rebase", NULL, 1, 1))
61766176
goto cleanup;
61776177

61786178
todo_list_write_total_nr(&new_todo);

wt-status.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,8 +2651,12 @@ int require_clean_work_tree(struct repository *r,
26512651
}
26522652

26532653
if (err) {
2654-
if (hint)
2654+
if (hint) {
2655+
if (!*hint)
2656+
BUG("empty hint passed to require_clean_work_tree();"
2657+
" use NULL instead");
26552658
error("%s", hint);
2659+
}
26562660
if (!gently)
26572661
exit(128);
26582662
}

0 commit comments

Comments
 (0)