From: Stefan Beller <sbeller@google.com>
To: Paul Tan <pyokagan@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Johannes Schindelin <johannes.schindelin@gmx.de>,
Stephen Robin <stephen.robin@gmail.com>
Subject: Re: [PATCH 14/14] pull --rebase: error on no merge candidate cases
Date: Mon, 18 May 2015 17:12:14 -0700 [thread overview]
Message-ID: <CAGZ79kbhA2+AJ1Vtz6khX5uEBCCUBUuXhpBezZApZsC_txhewA@mail.gmail.com> (raw)
In-Reply-To: <1431961571-20370-15-git-send-email-pyokagan@gmail.com>
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 next guess would have been personal preference, though there seem to be
actual reasons[1] why to use fputs.
Maybe mention the switch in the commit message (As the formatting is
unnecessary,
switch to the lighter fputs function)?
[1] http://stackoverflow.com/questions/5690979/fputs-vs-fprintf
> + else
> + fputs(_("There are no candidates for merging among the refs that you just fetched."), stderr);
> + fputs(_("Generally this means that you provided a wildcard refspec which had no\n"
> + "matches on the remote end."), stderr);
> } else if (repo && curr_branch && (!remote || strcmp(repo, remote))) {
> fprintf(stderr,
> _("You asked to pull from the remote '%s', but did not specify\n"
> @@ -485,12 +487,15 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
> "for your current branch, you must specify a branch on the command line.\n"),
> repo);
> } else if (!curr_branch) {
> - fprintf(stderr,
> - _("You are not currently on a branch. Please specify which\n"
> - "branch you want to merge with. See git-pull(1) for details.\n"
> - "\n"
> - " git pull <remote> <branch>\n"
> - "\n"));
> + fputs(_("You are not currently on a branch."), stderr);
> + if (opt_rebase)
> + fputs(_("Please specify which branch you want to rebase against."), stderr);
> + else
> + fputs(_("Please specify which branch you want to merge with."), stderr);
> + fputs(_("See git-pull(1) for details."), stderr);
> + fputs("", stderr);
> + fputs(" git pull <remote> <branch>", stderr);
> + fputs("", stderr);
> } else if (!curr_branch->merge_nr) {
> struct known_remote *remotes = NULL;
> const char *remote_name = "<remote>";
> @@ -499,14 +504,17 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
> if (remotes && !remotes->next)
> remote_name = remotes->remote->name;
>
> + fputs(_("There is no tracking information for the current branch."), stderr);
> + if (opt_rebase)
> + fputs(_("Please specify which branch you want to rebase against."), stderr);
> + else
> + fputs(_("Please specify which branch you want to merge with."), stderr);
> + fputs(_("See git-pull(1) for details."), stderr);
> + fputs("", stderr);
> + fputs(" git pull <remote> <branch>", stderr);
> + fputs("", stderr);
> fprintf(stderr,
> - _("There is no tracking information for the current branch.\n"
> - "Please specify which branch you want to merge with.\n"
> - "See git-pull(1) for details.\n"
> - "\n"
> - " git pull <remote> <branch>\n"
> - "\n"
> - "If you wish to set tracking information for this branch you can do so with:\n"
> + _("If you wish to set tracking information for this branch you can do so with:\n"
> "\n"
> " git branch --set-upstream-to=%s/<branch> %s\n"
> "\n"),
> --
> 2.1.4
>
next prev parent reply other threads:[~2015-05-19 0:12 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 15:05 [PATCH 00/14] Make git-pull a builtin Paul Tan
2015-05-18 15:05 ` [PATCH 01/14] pull: implement fetch + merge Paul Tan
2015-05-18 15:55 ` Johannes Schindelin
2015-05-18 15:05 ` [PATCH 02/14] pull: pass verbosity, --progress flags to fetch and merge Paul Tan
2015-05-18 17:41 ` Johannes Schindelin
2015-05-21 9:48 ` Paul Tan
2015-05-21 15:59 ` Johannes Schindelin
2015-05-22 13:38 ` Paul Tan
2015-05-18 15:06 ` [PATCH 03/14] pull: pass git-merge's options to git-merge Paul Tan
2015-05-18 15:06 ` [PATCH 04/14] pull: pass git-fetch's options to git-fetch Paul Tan
2015-05-18 15:06 ` [PATCH 05/14] pull: error on no merge candidates Paul Tan
2015-05-18 18:56 ` Johannes Schindelin
2015-05-18 15:06 ` [PATCH 06/14] pull: support pull.ff config Paul Tan
2015-05-18 19:02 ` Johannes Schindelin
2015-05-21 9:53 ` Paul Tan
2015-05-18 15:06 ` [PATCH 07/14] pull: check if in unresolved merge state Paul Tan
2015-05-18 19:06 ` Johannes Schindelin
2015-05-18 15:06 ` [PATCH 08/14] pull: fast-forward working tree if head is updated Paul Tan
2015-05-18 19:18 ` Johannes Schindelin
2015-05-18 15:06 ` [PATCH 09/14] pull: implement pulling into an unborn branch Paul Tan
2015-05-18 15:06 ` [PATCH 10/14] pull: set reflog message Paul Tan
2015-05-18 19:27 ` Johannes Schindelin
2015-05-18 21:53 ` Junio C Hamano
2015-05-21 10:08 ` Paul Tan
2015-05-18 15:06 ` [PATCH 11/14] pull: teach git pull about --rebase Paul Tan
2015-05-18 23:36 ` Stefan Beller
2015-05-19 13:04 ` Johannes Schindelin
2015-05-31 8:18 ` Paul Tan
2015-06-02 11:26 ` Paul Tan
2015-05-18 15:06 ` [PATCH 12/14] pull: configure --rebase via branch.<name>.rebase or pull.rebase Paul Tan
2015-05-18 23:58 ` Stefan Beller
2015-05-18 15:06 ` [PATCH 13/14] pull --rebase: exit early when the working directory is dirty Paul Tan
2015-05-18 15:06 ` [PATCH 14/14] pull --rebase: error on no merge candidate cases Paul Tan
2015-05-19 0:12 ` Stefan Beller [this message]
2015-05-19 13:10 ` Johannes Schindelin
2015-05-19 16:27 ` Junio C Hamano
2015-05-22 13:48 ` Paul Tan
2015-05-22 14:14 ` Johannes Schindelin
2015-05-22 17:12 ` Stefan Beller
2015-05-18 19:21 ` [PATCH 00/14] Make git-pull a builtin Junio C Hamano
2015-05-30 7:29 ` Paul Tan
2015-05-30 8:00 ` Paul Tan
2015-05-18 19:41 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGZ79kbhA2+AJ1Vtz6khX5uEBCCUBUuXhpBezZApZsC_txhewA@mail.gmail.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=pyokagan@gmail.com \
--cc=stephen.robin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).