All of lore.kernel.org
 help / color / mirror / Atom feed
* Cloning a custom refspec does not work as expected
@ 2017-05-03 12:16 Sebastian Schuberth
  2017-05-03 18:27 ` Stefan Beller
  2017-05-03 20:03 ` Jeff King
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Schuberth @ 2017-05-03 12:16 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I'm trying to clone a custom ref, avoiding the need to init && fetch
manually. From reading [1] which says:

"Set a configuration variable in the newly-created repository; this
takes effect immediately after the repository is initialized, but
before the remote history is fetched or any files checked out. [...]
This makes it safe, for example, to add additional fetch refspecs to
the origin remote."

I'd assume that this would work:

$ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*
https://gerrit.googlesource.com/git-repo

In fact, this *does* add the custom refs correct to .git/config, but
they are not fetched during the clone. I can manually fix that by
doing

$ cd git-repo
$ git fetch

afterwards, but the whole point is to avoid exactly that separate step.

Is this a code bug or documentation bug?

I'm using git version 2.12.2.windows.2.

[1] https://git-scm.com/docs/git-clone#git-clone---configltkeygtltvaluegt

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cloning a custom refspec does not work as expected
  2017-05-03 12:16 Cloning a custom refspec does not work as expected Sebastian Schuberth
@ 2017-05-03 18:27 ` Stefan Beller
  2017-05-03 20:03 ` Jeff King
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Beller @ 2017-05-03 18:27 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: Git Mailing List

On Wed, May 3, 2017 at 5:16 AM, Sebastian Schuberth
<sschuberth@gmail.com> wrote:
> Hi,
>
> I'm trying to clone a custom ref, avoiding the need to init && fetch
> manually. From reading [1] which says:
>
> "Set a configuration variable in the newly-created repository; this
> takes effect immediately after the repository is initialized, but
> before the remote history is fetched or any files checked out. [...]
> This makes it safe, for example, to add additional fetch refspecs to
> the origin remote."
>
> I'd assume that this would work:
>
> $ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*
> https://gerrit.googlesource.com/git-repo
>
> In fact, this *does* add the custom refs correct to .git/config, but
> they are not fetched during the clone. I can manually fix that by
> doing
>
> $ cd git-repo
> $ git fetch
>
> afterwards, but the whole point is to avoid exactly that separate step.
>
> Is this a code bug or documentation bug?

I would blame the code to be buggy, as it first writes out the config
and then doesn't read the config, but blindly performs some magic
to come up with the refspec to fetch and performs that fetch.

Thanks,
Stefan

>
> I'm using git version 2.12.2.windows.2.
>
> [1] https://git-scm.com/docs/git-clone#git-clone---configltkeygtltvaluegt
>
> --
> Sebastian Schuberth

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cloning a custom refspec does not work as expected
  2017-05-03 12:16 Cloning a custom refspec does not work as expected Sebastian Schuberth
  2017-05-03 18:27 ` Stefan Beller
@ 2017-05-03 20:03 ` Jeff King
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2017-05-03 20:03 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: SZEDER Gábor, Git Mailing List

On Wed, May 03, 2017 at 02:16:47PM +0200, Sebastian Schuberth wrote:

> I'd assume that this would work:
> 
> $ git clone -c remote.origin.fetch=+refs/changes/*:refs/remotes/origin/changes/*
> https://gerrit.googlesource.com/git-repo
> 
> In fact, this *does* add the custom refs correct to .git/config, but
> they are not fetched during the clone. I can manually fix that by
> doing
> 
> $ cd git-repo
> $ git fetch
> 
> afterwards, but the whole point is to avoid exactly that separate step.
> 
> Is this a code bug or documentation bug?

I think it's a code bug. More discussion in:

  http://public-inbox.org/git/robbat2-20170225T185056-448272755Z@orbis-terrarum.net/

-Peff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-03 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 12:16 Cloning a custom refspec does not work as expected Sebastian Schuberth
2017-05-03 18:27 ` Stefan Beller
2017-05-03 20:03 ` Jeff King

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.