Web lists-archives.com

Re: [GSoC][PATCH v3 02/13] rebase--interactive: rewrite append_todo_help() in C




Alban Gruin <alban.gruin@xxxxxxxxx> writes:

> This rewrites append_todo_help() from shell to C. It also incorporates
> some parts of initiate_action() and complete_action() that also write
> help texts to the todo file.
>
> This also introduces the source file rebase-interactive.c. This file
> will contain functions necessary for interactive rebase that are too
> specific for the sequencer, and is part of libgit.a.
>
> Two flags are added to rebase--helper.c: one to call
> append_todo_help() (`--append-todo-help`), and another one to tell
> append_todo_help() to write the help text suited for the edit-todo
> mode (`--write-edit-todo`).
>
> Finally, append_todo_help() is removed from git-rebase--interactive.sh
> to use `rebase--helper --append-todo-help` instead.
>
> Signed-off-by: Alban Gruin <alban.gruin@xxxxxxxxx>
> ---
> Unchanged from what have been queued on `pu` (ag/rebase-i-in-c), and
> from v2.

With something like '...except downcasing an error message "Could
not append..."', a comment like this is very much appreciated as it
helps readers who have read the previous round and remember what was
in there ;-)

> + ...
> +	if (get_missing_commit_check_level() == MISSING_COMMIT_CHECK_ERROR)
> +		msg = _("\nDo not remove any line. Use 'drop' "
> +			 "explicitly to remove a commit.\n");
> +	else
> +		msg = _("\nIf you remove a line here "
> +			 "THAT COMMIT WILL BE LOST.\n");
> +
> +	strbuf_add_commented_lines(&buf, msg, strlen(msg));

Nice use of strbuf_add_comment_lines() function ;-).