git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git clone --depth: shallow clone problems
@ 2015-04-23 14:53 Michal Pomorski
  2015-05-26 12:47 ` Duy Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Pomorski @ 2015-04-23 14:53 UTC (permalink / raw)
  To: git

tl: skip to the second paragraph

So here is what I just experienced:
We had an emergency error in an application at work and as the
responsible developer was unavailable, I was asked to check it out and
look into it.
We are a small branch of a bigger company and our connection to the
company's source servers is really slow, so just to quickly start it
up, I decided to take a shallow clone (that's what it is for, right?).
After a while we realized, the clone I have made was not sufficient
and was missing some newest work done on the project.
I did "git fetch --unshallow" which finished surprisingly quickly, and
it did not bring any newer commits.
Unaware of the fine print hiding in the documentation of git clone, I
blamed the repo (and in extension the person who provided me the
address to it). After coming to a realization, a process which cost me
time and embarrassment, I understood what is supposed to be the
"correct" behaviour:
"--single-branch
Clone only the history leading to the tip of a single branch, either
specified by the --branch option or the primary branch remote's HEAD
points at. When creating a shallow clone with the --depth option, this
is the default, unless --no-single-branch is given to fetch the
histories near the tips of all branches."
Of course, the new commits were put on a custom branch, and I knew
that all the time, but I expected the branch to show up eventually, at
least after git fetch --unshallow.


I hope you can see the faults in the usability of the commands I was exposed to:
1) git clone --depth  should:
   -warn about only fetching the current HEAD (name it by a real name
if applicable)
and/or
   -require the --branch option so that it is not left to chance
(current HEAD could be anything; is it really meaningful to talk about
the current HEAD on a server?)
and/or
   -make the --no-single-branch the default...
and maybe
   -have the option to clone the most recent commits.

2) git fetch --unshallow should convert the clone into an actual
equivalent of a normal, not shallow clone.

3) The documentation should be improved. The behaviour of --shallow is
described partly in the description of --no-single-branch. This is the
documentation equivalent of the infamous "come from" control flow
structure.

Regards,
Michal Pomorski

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

end of thread, other threads:[~2015-05-29 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 14:53 git clone --depth: shallow clone problems Michal Pomorski
2015-05-26 12:47 ` Duy Nguyen
2015-05-26 14:54   ` Junio C Hamano
2015-05-29 11:04     ` Duy Nguyen
2015-05-29 15:52       ` Junio C Hamano

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).