Re: [PATCH 14/14] pull --rebase: error on no merge candidate cases

From
Johannes Schindelin <hidden>
Date
2016-06-15 23:04:49
Reply to
Stefan Beller, 2016-06-15
Hi,

On 2015-05-19 02:12, Stefan Beller wrote:
On Mon, May 18, 2015 at 8:06 AM, Paul Tan [off-list ref] wrote:
quoted
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 <redacted>
---
 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
Thread (34 messages) 34 messages, 3 authors, last reply 2016-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help