git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, John Tapsell <johnflux@gmail.com>,
	Git List <git@vger.kernel.org>
Subject: Re: Confusing git pull error message
Date: Mon, 05 Oct 2009 13:32:34 +0200	[thread overview]
Message-ID: <4AC9D952.3050108@viscovery.net> (raw)
In-Reply-To: <7v1vmar353.fsf@alter.siamese.dyndns.org>

Junio C Hamano schrieb:
> Jeff King <peff@peff.net> writes:
>> I think it is enough for git-pull to just check whether the config
>> exists, and if so, guess that the ref was simply not fetched. IOW,
>> this:
> 
> Thanks.
> 
> I saw some discussion on improving the wording.  Here is what I plan to
> commit.
> 
> diff --git a/git-pull.sh b/git-pull.sh
> index 0bbd5bf..2c2fa79 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -89,6 +89,8 @@ error_on_no_merge_candidates () {
>  	done
>  
>  	curr_branch=${curr_branch#refs/heads/}
> +	upstream=$(git config "branch.$curr_branch.merge" ||
> +			git config "branch.$curr_branch.rebase")
>  
>  	if [ -z "$curr_branch" ]; then
>  		echo "You are not currently on a branch, so I cannot use any"
> @@ -96,7 +98,7 @@ 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."
> -	else
> +	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"
>  		echo "your configuration file does not tell me either.	Please"
> @@ -114,6 +116,10 @@ error_on_no_merge_candidates () {
>  		echo "    remote.<nickname>.fetch = <refspec>"
>  		echo
>  		echo "See git-config(1) for details."
> +	else
> +		echo "Your configuration specifies to merge the ref"
> +		echo "'${upstream#refs/heads/}' from the remote, but no such ref"
> +		echo "was fetched."
>  	fi
>  	exit 1
>  }

Unfortunately, this is not water-tight. See what I just observed:

  $ git pull hk
  From /exports/repos/hk/viscovery
     9455552..6429037  master     -> hk/master
  Your configuration specifies to merge the ref
  'master' from the remote, but no such ref
  was fetched.

The message is confusing when it says "'master' was not fetched" when
clearly master _was_ fetched.

More importantly, the message is wrong to say that "Your configuration
specifies to merge the ref 'master' from the remote", because I have this
configuration:

  $ git config -l | egrep '^(remote|branch)'
  remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
  remote.origin.url=/exports/repos/js/viscovery
  branch.master.remote=origin
  branch.master.merge=refs/heads/master
  remote.hk.url=/exports/repos/hk/viscovery
  remote.hk.fetch=+refs/heads/*:refs/remotes/hk/*

i.e. while on master, I merge master from "origin", not from "hk".

-- Hannes

  parent reply	other threads:[~2009-10-05 11:37 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 [this message]
2009-10-05 11:53       ` Jeff King
2009-10-05 12:13         ` Johannes Sixt
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=4AC9D952.3050108@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).