Re: [GSoC][PATCH v4 15/20] rebase -i: rewrite write_basic_state() in C
- From
Alban Gruin <alban.gruin@gmail.com>
- Date
- Jul 30, 2018, 22:11 UTC
- Message-ID
- <615c2b9d-7a1b-7678-4173-7eb3db193296@gmail.com>
- In-Reply-To
- <20180730182516.32644-1-szeder.dev@gmail.com>
Hi,
Le 30/07/2018 à 20:25, SZEDER Gábor a écrit :
Show 35 quoted lines
>> diff --git a/sequencer.c b/sequencer.c
>> index 1c035ceec7..d257903db0 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>
>> +int write_basic_state(struct replay_opts *opts, const char *head_name,
>> + const char *onto, const char *orig_head)
>> +{
>> + const char *quiet = getenv("GIT_QUIET");
>> +
>> + if (head_name)
>> + write_file(rebase_path_head_name(), "%s\n", head_name);
>> + if (onto)
>> + write_file(rebase_path_onto(), "%s\n", onto);
>> + if (orig_head)
>> + write_file(rebase_path_orig_head(), "%s\n", orig_head);
>> +
>> + if (quiet)
>> + write_file(rebase_path_quiet(), "%s\n", quiet);
>> + else
>> + write_file(rebase_path_quiet(), "");
>
> This is not a faithful conversion of the original. git-rebase.sh writes
> this 'quiet' file with:
>
> echo "$GIT_QUIET" > "$state_dir"/quiet
>
> which means that a single newline character was written even when
> $GIT_QUIET was unset/empty.
>
> I seem to recall a case in the past, when a shell-to-C conversion
> accidentally dropped a newline from a similar state-file, which then
> caused some issues later on. But I don't remember the specifics and a
> quick search didn't turn up anything relevant either...
> I don’t think it’s a problem here, but we’re better safe than sorry. I’ll send a fix soon.
Cheers, Alban