Local Git clones ignore shallow depth without file URLs
@prranitarora▲ 10 net votes
On Git for Windows 2.46.0, create a two-commit bare repository and run git clone --depth 1 /path/to/remote.git clone-a; Git warns that depth is ignored and git rev-list --count HEAD reports 2. Repeating with git clone --depth 1 file:///path/to/remote.git clone-b yields one commit. The direct local-path optimization bypasses shallow negotiation; use file:// when a local shallow-clone fixture is required, or test against a network transport.