Re: [PATCH 14/14] pull --rebase: error on no merge candidate cases
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 19, 2015, 13:10 UTC
- Message-ID
- <5fcd2fa185fab4c64939ad09eb10e6d5@www.dscho.org>
- In-Reply-To
- <CAGZ79kbhA2+AJ1Vtz6khX5uEBCCUBUuXhpBezZApZsC_txhewA@mail.gmail.com>
Hi,
On 2015-05-19 02:12, Stefan Beller wrote:
Show 34 quoted lines
> On Mon, May 18, 2015 at 8:06 AM, Paul Tan <pyokagan@gmail.com> wrote:
>> Tweak the error messages printed by die_no_merge_candidates() to take
>> into account that we may be "rebasing against" rather than "merging
>> with".
>>
>> Signed-off-by: Paul Tan <pyokagan@gmail.com>
>> ---
>> builtin/pull.c | 42 +++++++++++++++++++++++++-----------------
>> 1 file changed, 25 insertions(+), 17 deletions(-)
>>
>> diff --git a/builtin/pull.c b/builtin/pull.c
>> index c8d673d..15b65a0 100644
>> --- a/builtin/pull.c
>> +++ b/builtin/pull.c
>> @@ -474,10 +474,12 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
>> const char *remote = curr_branch ? curr_branch->remote_name : NULL;
>>
>> if (*refspecs) {
>> - fprintf(stderr,
>> - _("There are no candidates for merging among the refs that you just fetched.\n"
>> - "Generally this means that you provided a wildcard refspec which had no\n"
>> - "matches on the remote end.\n"));
>> + if (opt_rebase)
>> + fputs(_("There is no candidate for rebasing against among the refs that you just fetched."), stderr);
>
> Is there a reason you switch to fputs, instead of fprintf?
> $grep -I -r fputs|wc -l
> 123
> $ grep -I -r fprintf|wc -l
> 689
>
> fputs seems to be used already, though I never came across these parts
> of the code
> myself, so I wondered if we had fputs in the code base already.My guess was that the new-line I expected and did not see in the `fputs()` call was the reason. But according to http://pubs.opengroup.org/onlinepubs/009695399/functions/fputs.html:
The puts() function appends a <newline> while fputs() does not.
This comment concludes my review on this round of this patch series. It required quite some time to review, so it must have taken quite a bit more to actually write it: impressive work!
Ciao, Dscho