From: Ralf Thielow <ralf.thielow@gmail.com>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] clone: fix refspec on "--single-branch" option
Date: Fri, 14 Sep 2012 16:25:40 +0200 [thread overview]
Message-ID: <CAN0XMOJFG2_Ju8fcAcyTiUc3owjedpKX+LpHdBWdym36Hm0LdA@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8BLwd=XeHFqg5jb=yx3p6xdKuzvG+KvfotfLf0vfSZdRQ@mail.gmail.com>
On Fri, Sep 14, 2012 at 3:10 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> On Fri, Sep 14, 2012 at 1:48 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>> Who guarantees at this point in the codepath that option_branch is
>>> set when option_single_branch is non-zero? Until we talk with the
>>> remote, "clone --single-branch" without an explicit "--branch" will
>>> not learn which branch at the remote we are going to fetch (it will
>>> be their HEAD).
>>>
>>> I wonder if this should be more like this:
>>>
>>> if (option_single_branch) {
>>> if (option_branch)
>>> Your patch "+refs/heads/foo:refs/remotes/origin/foo";
>>> else
>>> "HEAD";
>>> } else {
>>> Original "+refs/heads/*:refs/remotes/origin/*";
>>> }
>>>
>>> That is, "clone --single-branch" will continue fetching from and
>>> integrating with their HEAD without storing any remote tracking
>>> branch.
>>
>> Alternatively, if you can move the logic to set up this
>> configuration further down so that it happens after we talked to the
>> other side and figured out remote_head_points_at, you could instead
>> set it up to keep a single remote tracking branch.
>
> That sounds reasonable. I have a question though, what should a user
> do when he/she want to fetch all branches again? Messing up with
> refspec in config file is not something I would like to do.
>
$ git remote set-branches <remote> "*"
> Perhaps a heuristic in git-fetch to detect "single branch" situation
> and ignore refspec? We could hint people that refspecs are not
> followed when remote has more than one branch. They could either fetch
> the another branch explicitly, which turns off the heuristic, or turn
> off the advice.
>
Such an advice when using "--single-branch" is a good idea, i think.
Something like "The remote <remote> is configured to fetch only branch <branch>.
If you want to fetch all branches, use "git remote set-branches <remote> "*""
or something like that.
>> Even if you did so, guess_remote_head() may not find any branch when
>> the other repository's HEAD is detached, so you would need to decide
>> what to do in such a case, and "fetch and integrate their HEAD
>> without using any remote tracking branch" may be a reasonable thing
>> to do in such a case.
> --
> Duy
next prev parent reply other threads:[~2012-09-14 14:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 18:38 is this behaviour expected for "git clone --single-branch"? Ralf Thielow
2012-09-13 18:45 ` Junio C Hamano
2012-09-13 18:48 ` Ralf Thielow
2012-09-14 5:09 ` [PATCH] clone: fix refspec on "--single-branch" option Ralf Thielow
2012-09-14 5:35 ` Junio C Hamano
2012-09-14 6:48 ` Junio C Hamano
2012-09-14 13:10 ` Nguyen Thai Ngoc Duy
2012-09-14 14:25 ` Ralf Thielow [this message]
2012-09-14 16:02 ` Junio C Hamano
2012-09-14 18:11 ` [PATCHv2] " Ralf Thielow
2012-09-14 19:22 ` Junio C Hamano
2012-09-14 21:13 ` [PATCHv3] " Ralf Thielow
2012-09-14 22:45 ` Junio C Hamano
2012-09-16 8:13 ` [PATCHv4] clone --single: limit the fetch refspec to fetched branch Ralf Thielow
2012-09-17 4:48 ` Junio C Hamano
2012-09-17 12:06 ` Nguyen Thai Ngoc Duy
2012-09-17 12:11 ` Nguyen Thai Ngoc Duy
2012-09-17 19:21 ` [PATCHv5] " Ralf Thielow
2012-09-17 20:18 ` Junio C Hamano
2012-09-17 21:04 ` Ralf Thielow
2012-09-17 21:39 ` Junio C Hamano
2012-09-18 14:08 ` Ralf Thielow
2012-09-18 16:57 ` Junio C Hamano
2012-09-18 19:14 ` [PATCHv6] " Ralf Thielow
2012-09-18 19:42 ` Junio C Hamano
2012-09-18 19:45 ` Junio C Hamano
2012-09-19 16:45 ` [PATCHv7] " Ralf Thielow
2012-09-19 23:26 ` Junio C Hamano
2012-09-20 18:04 ` [PATCHv8] " Ralf Thielow
2012-09-20 21:17 ` Junio C Hamano
2012-09-19 7:36 ` [PATCHv6] " Nguyen Thai Ngoc Duy
2012-09-19 8:24 ` Ralf Thielow
2012-09-17 20:09 ` [PATCHv4] " Junio C Hamano
2012-09-18 1:04 ` Nguyen Thai Ngoc Duy
2012-09-18 3:56 ` Junio C Hamano
2012-09-17 13:25 ` Ralf Thielow
2012-09-17 20:08 ` Junio C Hamano
2012-09-18 1:02 ` Nguyen Thai Ngoc Duy
2012-09-14 18:42 ` [PATCH] clone: fix refspec on "--single-branch" option 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=CAN0XMOJFG2_Ju8fcAcyTiUc3owjedpKX+LpHdBWdym36Hm0LdA@mail.gmail.com \
--to=ralf.thielow@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/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).