Git development
 help / color / mirror / Atom feed
From: "Tobias Schlüter" <tobi@schlueters.de>
To: git@vger.kernel.org
Subject: Shallow clones becomes not-shallow when cloning to a different drive
Date: Wed, 15 Nov 2023 22:12:49 +0900	[thread overview]
Message-ID: <f06d2964-3af2-425c-a68d-803ede45ee08@schlueters.de> (raw)


Hi,

I reported this on github but I was asked to take it here [*].  I had to 
deal with the following scenario today (on Windows, but not OS-specific):

$ git clone  --single-branch --branch feature/bla --depth 200 
~/source/Repos/bla ${PATH_ON_DOFFERENT_DRIVE}/bla
Cloning into './bla'...
warning: --depth is ignored in local clones; use file:// instead.
... run out of disk space because it does a full clone ...

Doing something different than the user asked for, and in a way that can 
lead to dangerous scenarios, is a bad choice.  In this case I was 
copying to a USB stick, but it could also be a system drive that runs 
out of space.

Additionally, the suggestion to use "file://" instead turned out to be 
impractical, as it is very slow.  I started the operation with 
"file://..." replacing the repository path on the command line before my 
lunch break.  When I came back it had copied a mere 100MB.

I would suggest to not imply "--local" when copying to a different 
device, and I would suggest to avoid doing something different than what 
the user asked for.  In this case I specifically asked for a shallow 
copy to save resources, the logic that a local copy using hard links 
actually saves more resources simply didn't apply.  Additionally, I 
would suggest investigating potential performance issues in the case of 
a shallow clone with file:// paths.

Please consider changing these choices and defaults.

Best regards,
- Tobi

[*] https://github.com/git-for-windows/git/issues/4693

                 reply	other threads:[~2023-11-15 13:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f06d2964-3af2-425c-a68d-803ede45ee08@schlueters.de \
    --to=tobi@schlueters.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox