git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] clone: make 'git clone -c remote.origin.fetch=<refspec>' work

From
Jeff King <peff@peff.net>
Date
Mar 7, 2016, 15:33 UTC
Message-ID
<20160307153304.GA23010@sigill.intra.peff.net>
In-Reply-To
<20160307161931.Horde.TcdEVtHKgSMvScCDUKLclVq@webmail.informatik.kit.edu>
On Mon, Mar 07, 2016 at 04:19:31PM +0100, SZEDER Gábor wrote:
Show 9 quoted lines
> >Even though I think the original description did not mean to include
> >the fetch refspecs when it talked about configuration taking effect,
> >I think what this change wants to do probably makes sense.
> 
> Well, currently one would have to clone, set additional fetch refspecs,
> fetch again and repack.  Using 'git clone -c <refspecs>' would do it in
> a single step, requiring fewer commands, less time, less data transfer
> and less disk space, which fits the justification of v1.7.7-rc0~90^2
> perfectly.

Yeah, I think your change very much fits the spirit of what the original commit was trying for.

Show 17 quoted lines
> >My knee-jerk reaction is to change the last paragraph of your log
> >message to read more like
> >
> >	Always read the fetch refspecs from the newly created config
> >	file, and use that for the initial fetching.
> >
> >and do so even when running with "--single-branch".
> 
> Ok, will change the '--single-branch' codepath as well.
> 
> But before doing so, to avoid a possible misunderstanding on my part:
> I'm not sure how literally you meant that "from the newly created
> config file" part, because it ignores refspecs specified via any
> other means, e.g. 'git -c <fetch-refspec> clone'.  I think the
> initial fetch should be no different from "regular" fetches, and
> should respect all configured fetch refspecs regardless where they
> come from.
IMHO, we should stick to the conceptual model that "git clone" is:
  git init
  git config ... ;# set up remote, etc
  git fetch
  git checkout ;# obviously not for --bare

The implementation has to diverge from that to do certain optimizations, but absent any good reason not to, I think we should aim for behaving "as if" those commands were run.

It certainly may produce surprising behavior at times, but at least it is a conceptually simple mental model. I do admit, though I haven't thought hard enough to know whether there are any terrible gotchas there.

-Peff
Previous: SZEDER GáborNext: Junio C Hamano
Message 4 of 12 in “clone: make 'git clone -c remote.origin.fetch=<refspec>' work”
  1. clone: make 'git clone -c remote.origin.fetch=<refspec>' workSZEDER Gábor, Mar 7, 2016
  2. Junio C HamanoMar 7, 2016
  3. SZEDER GáborMar 7, 2016
  4. Jeff KingMar 7, 2016
  5. Junio C HamanoMar 7, 2016
  6. clone: respect configured fetch respecs during initial fetchSZEDER Gábor, Mar 30, 2016
  7. Junio C HamanoMar 31, 2016
  8. Junio C HamanoMar 31, 2016
  9. SZEDER GáborMar 31, 2016
  10. Junio C HamanoMar 31, 2016
  11. SZEDER GáborApr 1, 2016
  12. SZEDER GáborApr 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.