Fetching deeper doesn't work on a freshly cloned shallow clone without running `git repack -d` first
In gitlab#227814 (comment 494433461), I discovered an issue that can be reproduced easily with the following steps:
› git clone --progress --no-checkout --shallow-since=2021-01-24 https://gitlab.com/gitlab-org/gitlab.git gitlab-shallow-2-days
Cloning into 'gitlab-shallow-2-days'...
remote: Enumerating objects: 52003, done.
remote: Counting objects: 100% (52003/52003), done.
remote: Compressing objects: 100% (45360/45360), done.
remote: Total 52003 (delta 7491), reused 30126 (delta 4206), pack-reused 0
Receiving objects: 100% (52003/52003), 88.48 MiB | 1.04 MiB/s, done.
Resolving deltas: 100% (7491/7491), done.
› cd gitlab-shallow-2-days
› git fetch --shallow-since=2021-01-22
fatal: error in object: unshallow 00c4ae28884d3ca2b6036bec08e8385b6f91a502
Now, running git repack -d
first seems to solve the problem:
› git repack -d
Enumerating objects: 48306, done.
Nothing new to pack.
› git fetch --shallow-since=2021-01-22
remote: Enumerating objects: 23278, done.
remote: Counting objects: 100% (7409/7409), done.
remote: Compressing objects: 100% (3975/3975), done.
remote: Total 4835 (delta 2936), reused 1960 (delta 660), pack-reused 0
Receiving objects: 100% (4835/4835), 2.76 MiB | 1.11 MiB/s, done.
Resolving deltas: 100% (2936/2936), completed with 1524 local objects.
From https://gitlab.com/gitlab-org/gitlab
a32e201d2..1f7e19071 master -> origin/master