Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-08 Thread Phillip Wood
Hi Alban On 08/08/18 16:16, Alban Gruin wrote: Hi Phillip, Le 07/08/2018 à 15:57, Phillip Wood a écrit : + if (ret < 0) + error_errno(_("could not append help text to '%s'"), rebase_path_todo()); + + fclose(todo); You should definitely check the return value and

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-08 Thread Alban Gruin
Hi Phillip, Le 07/08/2018 à 15:57, Phillip Wood a écrit : >> +if (ret < 0) >> +error_errno(_("could not append help text to '%s'"), >> rebase_path_todo()); >> + >> +fclose(todo); > > You should definitely check the return value and return an error if > appropriate as fputs()

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Christian On 07/08/18 17:28, Christian Couder wrote: > On Tue, Aug 7, 2018 at 6:15 PM, Phillip Wood > wrote: >> On 07/08/18 16:25, Christian Couder wrote: >>> >>> I agree about checking the return value from fputs(), but it seems to >>> me that we don't usually check the value of fclose(). >>

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Christian Couder
On Tue, Aug 7, 2018 at 6:15 PM, Phillip Wood wrote: > On 07/08/18 16:25, Christian Couder wrote: >> >> I agree about checking the return value from fputs(), but it seems to >> me that we don't usually check the value of fclose(). > > A quick grep shows you're right, there are only a handful of

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Christian On 07/08/18 16:25, Christian Couder wrote: Hi Phillip, On Tue, Aug 7, 2018 at 3:57 PM, Phillip Wood wrote: On 31/07/18 18:59, Alban Gruin wrote: + + ret = fputs(buf.buf, todo); It is not worth changing the patch just for this but strbuf_write() might be clearer (you use

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Christian Couder
Hi Phillip, On Tue, Aug 7, 2018 at 3:57 PM, Phillip Wood wrote: > > On 31/07/18 18:59, Alban Gruin wrote: >> >> + >> + ret = fputs(buf.buf, todo); > > It is not worth changing the patch just for this but strbuf_write() > might be clearer (you use it in a later patch) > >> + if (ret < 0)

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Alban On 31/07/18 18:59, Alban Gruin wrote: > 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

[GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-07-31 Thread Alban Gruin
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