git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 6/6] pull: trivial cleanup
Date: Fri, 30 Aug 2013 20:58:10 -0700	[thread overview]
Message-ID: <xmqq38pqwlyl.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1377899810-1818-7-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Fri, 30 Aug 2013 16:56:50 -0500")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> There's no need to remove 'refs/heads/' yet again.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  git-pull.sh | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/git-pull.sh b/git-pull.sh
> index f0df41c..3bdcbfd 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -166,7 +166,6 @@ error_on_no_merge_candidates () {
>  		op_prep=with
>  	fi
>  
> -	curr_branch=${curr_branch#refs/heads/}

The code assumes that at this point $curr_branch has the result of
git symbolic-ref -q HEAD it did at the beginning, before it entered
in the command line parsing loop.  But immediately after it, the
code sets up $curr_branch_short for the value this code computes.

>  	upstream=$(git config "branch.$curr_branch.merge")
>  	remote=$(git config "branch.$curr_branch.remote")

So it appears to me that the above two lines that are not updated
would introduce a regression.  Am I missing something trivial?

Puzzled.


> @@ -183,7 +182,7 @@ error_on_no_merge_candidates () {
>  		echo "You asked to pull from the remote '$1', but did not specify"
>  		echo "a branch. Because this is not the default configured remote"
>  		echo "for your current branch, you must specify a branch on the command line."
> -	elif [ -z "$curr_branch" -o -z "$upstream" ]; then
> +	elif [ -z "$curr_branch_short" -o -z "$upstream" ]; then

If $curr_branch in the original code was (wasn't) an empty string,
then with the updated code that does not strip refs/heads/ from the
beginning of it after applying the first hunk of this patch, the
variable is (isn't) an empty string, respectively. So there is no
need for this hunk, I think.

>  		. git-parse-remote
>  		error_on_missing_default_upstream "pull" $op_type $op_prep \
>  			"git pull <remote> <branch>"

  reply	other threads:[~2013-08-31  3:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30 21:56 [PATCH 0/6] Trivial cleanups and fixes Felipe Contreras
2013-08-30 21:56 ` [PATCH 1/6] reset: trivial refactoring Felipe Contreras
2013-08-31  3:36   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 2/6] branch: trivial style fix Felipe Contreras
2013-08-31  3:36   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 3/6] rebase: trivial style fixes Felipe Contreras
2013-08-31  3:49   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 4/6] reset: trivial style cleanup Felipe Contreras
2013-08-31  3:49   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 5/6] add: " Felipe Contreras
2013-08-31  3:37   ` Junio C Hamano
2013-08-30 21:56 ` [PATCH 6/6] pull: trivial cleanup Felipe Contreras
2013-08-31  3:58   ` Junio C Hamano [this message]
2013-08-31  7:56     ` Felipe Contreras
2013-08-31  8:10     ` [PATCH] branch: use $curr_branch_short more René Scharfe
2013-08-31  8:22       ` Felipe Contreras
2013-08-31  9:11         ` René Scharfe
2013-08-31  9:22           ` Felipe Contreras
2013-08-31 10:28             ` René Scharfe
2013-08-31 17:20               ` Felipe Contreras
2013-09-08 15:21                 ` René Scharfe
2013-09-08 23:13                   ` Felipe Contreras
2013-09-15 11:42                     ` René Scharfe
2013-09-15 13:02                       ` Felipe Contreras
2013-09-03 16:56         ` Junio C Hamano
2013-09-08 15:21       ` [PATCH] pull: " René Scharfe

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=xmqq38pqwlyl.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    /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).