{"thread":{"id":"60525","subject":"Shallow clones becomes not-shallow when cloning to a different drive","startedAt":"2023-11-15T13:18:06Z","lastAt":"2023-11-15T13:18:06Z","messageCount":1,"participants":["Tobias Schlüter"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"484917","messageId":"f06d2964-3af2-425c-a68d-803ede45ee08@schlueters.de","threadId":"60525","inReplyTo":null,"subject":"Shallow clones becomes not-shallow when cloning to a different drive","fromName":"Tobias Schlüter","fromEmail":"tobi@schlueters.de","sentAt":"2023-11-15T13:12:49Z","receivedAt":"2023-11-15T13:18:06Z","isPatch":false,"sender":{"key":"tobi@schlueters.de","avatar":null},"body":"\nHi,\n\nI reported this on github but I was asked to take it here [*].  I had to \ndeal with the following scenario today (on Windows, but not OS-specific):\n\n$ git clone  --single-branch --branch feature/bla --depth 200 \n~/source/Repos/bla ${PATH_ON_DOFFERENT_DRIVE}/bla\nCloning into './bla'...\nwarning: --depth is ignored in local clones; use file:// instead.\n... run out of disk space because it does a full clone ...\n\nDoing something different than the user asked for, and in a way that can \nlead to dangerous scenarios, is a bad choice.  In this case I was \ncopying to a USB stick, but it could also be a system drive that runs \nout of space.\n\nAdditionally, the suggestion to use \"file://\" instead turned out to be \nimpractical, as it is very slow.  I started the operation with \n\"file://...\" replacing the repository path on the command line before my \nlunch break.  When I came back it had copied a mere 100MB.\n\nI would suggest to not imply \"--local\" when copying to a different \ndevice, and I would suggest to avoid doing something different than what \nthe user asked for.  In this case I specifically asked for a shallow \ncopy to save resources, the logic that a local copy using hard links \nactually saves more resources simply didn't apply.  Additionally, I \nwould suggest investigating potential performance issues in the case of \na shallow clone with file:// paths.\n\nPlease consider changing these choices and defaults.\n\nBest regards,\n- Tobi\n\n[*] https://github.com/git-for-windows/git/issues/4693\n"}]}