Re: Fetching single tag in shallow clone almost unshallow the clone
- From
Derrick Stolee <stolee@gmail.com>
- Date
- May 28, 2021, 11:40 UTC
- Message-ID
- <d641512e-657f-6dfc-adf4-1b1889439553@gmail.com>
- In-Reply-To
- <304633fd-e677-7956-6787-f60f195db9b5@gmail.com>
On 5/28/2021 3:03 AM, Bagas Sanjaya wrote:> But when I fetch a single tag which the commit the tag refers to isn't already on the clone, Git fetched almost the entire history (thus almost unshallow the clone):
> > $ git fetch origin tag go1.16.1 --no-tags
You should add a --depth here, too. Git doesn't remember that you want a certain depth, because that doesn't work in perpetuity.
You are hitting the issue I documented in my comparison between partial and shallow clones [1]: The commit history for go1.16.1 goes "around" your shallow boundary. See the image immediately above the "Comparing Clone Options" section.
[1] https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
Thanks, -Stolee