git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	John Tapsell <johnflux@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: Confusing git pull error message
Date: Mon, 05 Oct 2009 14:13:18 +0200	[thread overview]
Message-ID: <4AC9E2DE.8050108@viscovery.net> (raw)
In-Reply-To: <20091005115308.GA2122@coredump.intra.peff.net>

Jeff King schrieb:
> On Mon, Oct 05, 2009 at 01:32:34PM +0200, Johannes Sixt wrote:
> Ah, yeah. Looking at %(upstream) from for-each-ref (which is how we
> determine to show that message) always uses the configured remote. But
> if we have asked for another remote, then that doesn't make much sense.
> 
> So I think we need something like this. I wasn't able to figure out a
> test case to trigger the first code path below, though. It may not be
> possible; if we give a refspec on the command line, either it will be a
> candidate for merging or, if it does not exist, fetch will barf. So it
> may be that we can just collapse it down to a single case.
> 
> diff --git a/git-pull.sh b/git-pull.sh
> index edf3ce3..a831db5 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -97,6 +97,18 @@ error_on_no_merge_candidates () {
>  		echo "Please specify which branch you want to merge on the command"
>  		echo "line and try again (e.g. 'git pull <repository> <refspec>')."
>  		echo "See git-pull(1) for details."
> +	elif [ -n "$1" ]; then
> +		if [ $# -gt 1 ]; then
> +			echo "You asked to pull from the remote '$1', but none"
> +			echo "of the things you asked to fetch were candidates"
> +			echo "for merging."
> +		else
> +			echo "You asked to pull from the remote '$1', but did"
> +			echo "not specify a branch to merge. Because this is"
> +			echo "not the default configured remote for your current"
> +			echo "branch, you must specify a branch on the command"
> +			echo "line."
> +		fi
>  	elif [ -z "$upstream" ]; then
>  		echo "You asked me to pull without telling me which branch you"
>  		echo "want to merge with, and 'branch.${curr_branch}.merge' in"

Thanks, this gives a much better error message.

But, can we *please* have a more pleasantly wrapped message, even if this
grows lines in the source code beyond the 80 char limit? Like:

	echo "You asked to pull from the remote '$1',"
	echo "but did not specify a branch to merge. Because this is"
	echo "not the default configured remote for your current branch,"
	echo "you must specify a branch on the command line."

I.e.:

- Reserve more room for a long $1 in the first line.

- Don't wrap lines in "current branch" and "command line" when they are at
the end of a major logical unit of the sentence.

-- Hannes

  reply	other threads:[~2009-10-05 12:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 20:01 Confusing git pull error message John Tapsell
2009-09-12 21:11 ` Jeff King
2009-09-12 21:31   ` John Tapsell
2009-09-12 22:34     ` Jeff King
2009-09-12 21:37   ` Sverre Rabbelier
2009-09-12 22:31     ` Jeff King
2009-09-12 22:37       ` Sverre Rabbelier
2009-09-13 20:38   ` Junio C Hamano
2009-09-13 20:42     ` Jeff King
2009-09-13 20:57       ` Junio C Hamano
2009-09-13 21:36         ` Jeff King
2009-09-13 22:11           ` Junio C Hamano
2009-09-13 20:57       ` John Tapsell
2009-09-13 21:18         ` Junio C Hamano
2009-09-13 21:16       ` Junio C Hamano
2009-09-13 22:39         ` Jeff King
2009-09-14 11:14     ` Jeff King
2009-10-05 11:32     ` Johannes Sixt
2009-10-05 11:53       ` Jeff King
2009-10-05 12:13         ` Johannes Sixt [this message]
2009-10-05 19:08         ` Junio C Hamano
2009-10-05 19:12           ` Jeff King
2009-10-05 19:35             ` Jeff King
2009-10-08 22:01               ` Nanako Shiraishi
2009-10-09  7:38                 ` Junio C Hamano
2009-10-10  0:57                   ` Junio C Hamano
2009-10-05 19:36             ` Junio C Hamano
2009-10-05 22:00               ` Jeff King

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=4AC9E2DE.8050108@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.com \
    --cc=peff@peff.net \
    /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).