All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Strapetz <marc.strapetz@syntevo.com>
To: "Carlos Martín Nieto" <cmn@dwim.me>
Cc: git@vger.kernel.org
Subject: Re: branch --set-upstream-to unexpectedly fails with "starting point ... is no branch"
Date: Mon, 23 Nov 2015 19:59:48 +0100	[thread overview]
Message-ID: <56536224.3050306@syntevo.com> (raw)
In-Reply-To: <15ED3D48-282B-44EF-98C6-EA59F18D633E@dwim.me>

On 23.11.2015 18:04, Carlos Martín Nieto wrote:
> Hello Mark,
>
> On 23 Nov 2015, at 12:04, Marc Strapetz <marc.strapetz@syntevo.com> wrote:
>
>> There is a strange "branch --set-upstream-to" failure for "clones" which haven't been created using "git clone" but constructed using "git init", "git remote add" and "git fetch".
>>
>> Following script first creates a "main" repository and then constructs the clone. Finally, in the clone branches origin/1 and origin/2 will be present, however it's not possible to invoke "git branch --set-upstream-to" for origin/2 (it works fine for origin/1).
>>
>> I guess the behavior is related to following line in .git/config:
>>
>> fetch = refs/heads/1:refs/remotes/origin/1
>>
>> However, I don't understand what's the problem for Git here? Definitely the error "starting point 'origin/2' is not a branch" is wrong.
>>
>
> That is indeed the issue. The configuration which is stored in the configuration is a remote+branch pair. If there is no fetch refspec configured which would create the ‘origin/2’ remote-tracking branch, the command does not know which remote and branch that would correspond to.

Thanks, Carlos, I understand now.

My goal is to have a clone which will only fetch specific branches, so I 
guess I have to stick with "refs/heads/1:refs/remotes/origin/1" for the 
beginning and for every new branch X add another 
"refs/heads/X:refs/remotes/origin/X"? Or is there a better way?

-Marc

  reply	other threads:[~2015-11-23 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 11:04 branch --set-upstream-to unexpectedly fails with "starting point ... is no branch" Marc Strapetz
2015-11-23 17:04 ` Carlos Martín Nieto
2015-11-23 18:59   ` Marc Strapetz [this message]
2015-11-24 16:58     ` Carlos Martín Nieto
2015-11-25 16:27       ` Marc Strapetz

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=56536224.3050306@syntevo.com \
    --to=marc.strapetz@syntevo.com \
    --cc=cmn@dwim.me \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.