]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.h
sequencer: introduce todo_list_write_to_file()
authorAlban Gruin <alban.gruin@gmail.com>
Tue, 29 Jan 2019 15:01:48 +0000 (16:01 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jan 2019 20:09:24 +0000 (12:09 -0800)
commit616d7740cfbe65533af8ff1dabcf4e56f6baad5a
treef77ddc77782231113d0b828c7a36a0556553f204
parentcbef27d61cd6ae4f1ecae054eb9df06e898148d8
sequencer: introduce todo_list_write_to_file()

This introduces a new function to recreate the text of a todo list from
its commands and write it to a file.  This will be useful as the next
few commits will change the use of the buffer in struct todo_list so it
will no longer be a mirror of the file on disk.

This functionality already exists in todo_list_transform(), but this
function was made to replace the buffer of a todo list, which is not
what we want here.  Thus, the part of todo_list_transform() that
replaces the buffer is dropped, and the function is renamed
todo_list_to_strbuf().  It is called by todo_list_write_to_file() to
fill the buffer to write to the disk.

todo_list_write_to_file() can also take care of appending the help text
to the buffer before writing it to the disk, or to write only the first
n items of the list.  This feature will be used by
skip_unnecessary_picks(), which has to write done commands in a file.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
sequencer.h