Re: [RFC/PATCH] clone: make 'git clone -c remote.origin.fetch=<refspec>' work
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Mar 7, 2016, 15:19 UTC
- Message-ID
- <20160307161931.Horde.TcdEVtHKgSMvScCDUKLclVq@webmail.informatik.kit.edu>
- In-Reply-To
- <xmqqfuw3rrwb.fsf@gitster.mtv.corp.google.com>
Quoting Junio C Hamano <gitster@pobox.com>:
Show 12 quoted lines
> SZEDER Gábor <szeder@ira.uka.de> writes: > >> Check whether there are any relevant configured fetch refspecs and >> take those into account during the initial fetch, unless running 'git >> clone --single-branch'. >> >> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> >> --- > > 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.
Or init, add remote, set additional refspecs and fetch, which still requires more commands, but at least doesn't transfer more data.
Show 12 quoted lines
>> I'm unsure what to do with the '-c <fetch-refspec> --single-branch' >> combination: it doesn't really make sense to me and can't imagaine a >> use case where it would be useful... but perhaps I just lack >> imagination on this Sunday night. Hence the RFC. > > 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.