# Shallow clones becomes not-shallow when cloning to a different drive

1 messages from 2023-11-15 to 2023-11-15. Participants: Tobias Schlüter.
Thread: https://gitlist.dev/t/60525

## Tobias Schlüter, 2023-11-15 13:12

Subject: Shallow clones becomes not-shallow when cloning to a different drive
Message-ID: <f06d2964-3af2-425c-a68d-803ede45ee08@schlueters.de>
URL: https://gitlist.dev/e/f06d2964-3af2-425c-a68d-803ede45ee08%40schlueters.de

```

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

```
