public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Siddharth Agarwal <sid0@fb•com>, git@vger•kernel.org, john@keeping•me.uk
Subject: Re: with git-next, git pull --rebase can print out "fatal: No such ref: ''" for branches without an upstream
Date: Fri, 17 Jan 2014 10:57:56 -0800	[thread overview]
Message-ID: <xmqq8uuexwp7.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140117022152.GB12444@sigill.intra.peff.net> (Jeff King's message of "Thu, 16 Jan 2014 21:21:52 -0500")

Jeff King <peff@peff•net> writes:

> On Thu, Jan 16, 2014 at 05:08:14PM -0800, Siddharth Agarwal wrote:
>
>> With git-next, where git pull --rebase can print out "fatal: No such
>> ref: ''" if git pull --rebase is run on branches without an upstream.
>
> This is already fixed in bb3f458 (rebase: fix fork-point with zero
> arguments, 2014-01-09), I think.

Doesn't the call to get_remote_merge_branch in this part

        test -n "$curr_branch" &&
        . git-parse-remote &&
        remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
        oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch)

yield an empty string, feeding it to "merge-base --fork-point" as
its first parameter?

Perhaps something like this is needed?

 git-pull.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-pull.sh b/git-pull.sh
index 605e957..467c66c 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -229,6 +229,7 @@ test true = "$rebase" && {
 	test -n "$curr_branch" &&
 	. git-parse-remote &&
 	remoteref="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
+	test -n "$remoteref" &&
 	oldremoteref=$(git merge-base --fork-point "$remoteref" $curr_branch)
 }
 orig_head=$(git rev-parse -q --verify HEAD)

  parent reply	other threads:[~2014-01-17 18:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  1:08 with git-next, git pull --rebase can print out "fatal: No such ref: ''" for branches without an upstream Siddharth Agarwal
2014-01-17  2:21 ` Jeff King
2014-01-17  2:47   ` Siddharth Agarwal
2014-01-17  8:40     ` John Keeping
2014-01-17 18:09       ` Siddharth Agarwal
2014-01-17 18:57   ` Junio C Hamano [this message]
2014-01-17 19:26     ` John Keeping
2014-01-17 20:00       ` [PATCH] pull: suppress error when no remoteref is found John Keeping
2014-01-17 20:02       ` with git-next, git pull --rebase can print out "fatal: No such ref: ''" for branches without an upstream Junio C Hamano

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=xmqq8uuexwp7.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=john@keeping$(echo .)me.uk \
    --cc=peff@peff$(echo .)net \
    --cc=sid0@fb$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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