diff mbox series

[v4,5/8] sequencer: reencode revert/cherry-pick's todo list

Message ID 304ac6c28972a7bec9c5c7b5e2ae3c107161e84f.1573094789.git.congdanhqx@gmail.com (mailing list archive)
State New, archived
Headers show
Series Correct internal working and output encoding | expand

Commit Message

Đoàn Trần Công Danh Nov. 7, 2019, 2:56 a.m. UTC
Keep revert/cherry-pick's todo list in line with rebase todo list.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
---
 sequencer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jeff King Nov. 7, 2019, 6:06 a.m. UTC | #1
On Thu, Nov 07, 2019 at 09:56:16AM +0700, Doan Tran Cong Danh wrote:

> Keep revert/cherry-pick's todo list in line with rebase todo list.

I think this is the right thing to do, but it might bear a little more
explanation. Maybe:

  The user may see this todo list in their editor, so we should output
  it in the encoding they generally expect to see, not whatever encoding
  the commit was originally in. This also matches the behavior of the
  rebase todo list.

-Peff
diff mbox series

Patch

diff --git a/sequencer.c b/sequencer.c
index 69430fe23f..a19954f2bf 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2564,14 +2564,17 @@  static int walk_revs_populate_todo(struct todo_list *todo_list,
 	enum todo_command command = opts->action == REPLAY_PICK ?
 		TODO_PICK : TODO_REVERT;
 	const char *command_string = todo_command_info[command].str;
+	const char *encoding;
 	struct commit *commit;
 
 	if (prepare_revs(opts))
 		return -1;
 
+	encoding = get_log_output_encoding();
+
 	while ((commit = get_revision(opts->revs))) {
 		struct todo_item *item = append_new_todo(todo_list);
-		const char *commit_buffer = get_commit_buffer(commit, NULL);
+		const char *commit_buffer = logmsg_reencode(commit, NULL, encoding);
 		const char *subject;
 		int subject_len;