Reputation: 69954
A script I am debugging is supposed to use --depth 1
when cloning a git repository in order to avoid downloading all its history. However, I suspect it might be buggy and that it is actually performing a full clone.
How can I inspect the resulting repository to determine if it was cloned with --depth 1
or not?
Upvotes: 3
Views: 1143
Reputation: 51423
After you made a shallow clone --depth 1
use
git rev-list --count --all
if it outputs 1
you only have 1 commit in the object database.
Does the script use the --no-single-branch
option?
This would explain why git fetches multiple commits (each for every branch or tag)
Upvotes: 2
Reputation: 225064
If the contents of .git/shallow
are the same as git rev-parse HEAD
, the depth is 1.
Upvotes: 3