Re: [PATCH v3 3/4] gitfaq: shallow cloning a repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 21, 2020 at 1:00 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Shourya Shukla <shouryashukla.oo@xxxxxxxxx> writes:
>
> > Add issue in 'Common issue' section which covers issues with cloning
> > large repositories. Use shallow cloning to clone the repository in
> > a smaller size.
> >
> > Signed-off-by: Shourya Shukla <shouryashukla.oo@xxxxxxxxx>
> > ---
> >  Documentation/gitfaq.txt | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/Documentation/gitfaq.txt b/Documentation/gitfaq.txt
> > index 13d37f96af..cea293cf07 100644
> > --- a/Documentation/gitfaq.txt
> > +++ b/Documentation/gitfaq.txt
> > @@ -275,6 +275,20 @@ I want to change the remote of my repository. How do I do that?::
> >  One can list the remotes of a repository using `git remote -v` command.
> >  The default name of a remote is 'origin'.
> >
> > +[[shallow-cloning]]
> > +The repository I am trying to clone is too big. Is there an alternative
> > +way of cloning it in lesser space?::
> > +     One can clone a repository having a truncated history, meaning the
> > +     history will span upto a specified number of commits instead of
> > +     the whole history of the repository. This is called 'Shallow Cloning'.
> > ...
>
> The question is worth keeping but the answer is questionable.
>
> I have a feeling that --depth/shallow is deprecated/frowned upon
> these days and more people recommend partial/blob-less clones
> instead (a few random people added to Cc: to see if they want to say
> something here).

I don't have a problem with us saying we have to support shallow
clones for years or decades more, but I personally strongly dislike
advertising it, for multiple reasons:

* From an internal perspective: The shallow clone implementation feels
like a hack that isn't extensible and doesn't work with other
features, and as far as I can tell that's intrinsic to its design.

* From an end-user perspective: Shallow clones are heavily misused,
oversold, and induce or perpetuate various misunderstandings.  CI
systems seem especially keen on turning on shallow clones whether
requested or not and breaking all sorts of things from simple (like
'git describe') to the more complex (like merge this branch with
master and run tests there too to avoid breaks due to semantic
conflicts) and all sorts of things inbetween (e.g. when trying to
'debug with SSH' the user can't look around in the repo because it's
all missing).  Despite the huge waste of time projects induce by
defaulting this on and sometimes making it hard to turn off, is to
'save space' and they often sell it as a dramatic savings.  B if it's
a standard source code repository then usually you save only about 50%
of the overall download size. (Years ago, I used to like to point out
that a git clone of a repo would only be marginally bigger than a svn
checkout, despite having 'all history', and had a handful of repos
where I had measured the cost to back it up).  The way CI folks talk
about shallow clone makes people assume that 'all history' is
hundreds/thousands of times bigger than the most recent checkout.  The
only case where 'saving size' seems to matter is either the special
simple cases that have really simple builds (though they tend to be
small enough that the size doesn't matter anyway) or for repos that
have accidentally committed huge files in their history that are no
longer present in new versions.  But because shallow clones are touted
so much, people come to perceive the cost of 'all history' as being a
very onerous requirement in git.  And the perception seems to be
sticking in lots of places.  I can sometimes go dig out facts for a
repository in question to show people the differences in sizes and
dispel some of this, but that's a one-by-one case.  I think these
misunderstandings hurt us as a community.

* Diversion of resources: Even though there are current valid usecases
for shallow clones (e.g. Randall sounds like he has some), advertising
this feature is going to make it harder for us to focus efforts on the
better designed solutions we want to implement and extend.  Perhaps a
funny story is in order: At $FORMER_JOB, we made software used by
various groups on supercomputers (or high performance computers, or
however you want to refer to that class of many machines).  One
customer requested support on Itanium machines, and we made the
necessary (though painful) adjustments.  At some point we decide to
list our supported platforms on the DVDs we sent out.  Then at some
point, the Navy decides they're going to buy some nice
supercomputer(s).  They want to use our software, but also want to use
general well-supported industry standard hardware.  They put out a
purchase order for $100 million (I don't remember the real number but
it was large), and overlooked specifying the computer architecture.
Vendors who were just about to retire the very last Itanium chips and
were literally going to just scrap the rest of their inventory notice
this purchase order, bid on the procurement at dirt cheap prices, and
then the Navy is stuck because of "don't waste taxpayer dollars" and
"procurement has to be fair".  They need those machines to work for
several years.  Anyone who provides them software has to support that
architecture for several more years, but the vendors would not sell
any more Itanium machines after that even if you begged, so we were
working with some really old Itanium machines that didn't have enough
power to run the basic regression test in under 24 hours.  The last
sysadmin at $FORMER_JOB with the necessary qualifications to actually
maintain those systems (not just knowledge but red tape box checking
too; this was government after all) was retiring about a year and a
half before the mandatory support period ended for us as well.  We
found out at some point that they checked our requirements before
putting out the purchase order; had our DVDs only advertised support
for x86_64, the whole debacle could have been avoided.

Yes we totally need to support shallow clones (I brought them up as a
concern for fetch.writeCommitGraphs just last week after all), but I
really don't want to advertise them, and if we need to in some way,
then minimize it.

Anyway, that's my $0.02.

Elijah



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux