7

I'm trying to unshallow a repository:

% /bin/git clone --shallow-since='3 years' 'https://github.com/RobertAudi/zsh-hooks'
Cloning into 'zsh-hooks'...
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 17 (delta 6), reused 12 (delta 4), pack-reused 0
Unpacking objects: 100% (17/17), 5.29 KiB | 1.76 MiB/s, done.
% cd zsh-hooks && git remote -v
origin  https://github.com/RobertAudi/zsh-hooks (fetch)
origin  ssh://github.com/RobertAudi/zsh-hooks (push)
% git fetch --unshallow origin
fatal: error in object: unshallow 9301f4e3a16df8e7cf8f37b5b93a7b925d8c8bee
fatal: the remote end hung up unexpectedly

I have also tried changing the origin's https to git and ssh, but no joy.

Setting:

git config http.postBuffer 524288000

Had no effect.

I only have 5 commits in my local repo, and trying to increase the depth also failed:

% git fetch --depth=10
fatal: error in object: unshallow 9301f4e3a16df8e7cf8f37b5b93a7b925d8c8bee

Further debug info:

% GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_CURL_VERBOSE=1 /bin/git fetch --depth=10
12:35:07.106657 git.c:444               trace: built-in: git fetch --depth=10
12:35:07.212298 pkt-line.c:80           packet:        fetch> git-upload-pack /RobertAudi/zsh-hooks\0host=github.com\0
12:35:07.802015 pkt-line.c:80           packet:        fetch< 2a9f56433c86b332df367f6a350026e1e91035a6 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want symref=HEAD:refs/heads/master filter agent=git/github-g8735eb3c5505
12:35:07.803152 pkt-line.c:80           packet:        fetch< 75e97419cf96200cfcc4c186611f645158385dd2 refs/heads/installation-instructions
12:35:07.803162 pkt-line.c:80           packet:        fetch< 2a9f56433c86b332df367f6a350026e1e91035a6 refs/heads/master
12:35:07.803166 pkt-line.c:80           packet:        fetch< 0000
12:35:07.811717 pkt-line.c:80           packet:        fetch> want 2a9f56433c86b332df367f6a350026e1e91035a6 multi_ack_detailed side-band-64k thin-pack include-tag ofs-delta deepen-since deepen-not agent=git/2.28.0
12:35:07.811740 pkt-line.c:80           packet:        fetch> shallow 9301f4e3a16df8e7cf8f37b5b93a7b925d8c8bee
12:35:07.811747 pkt-line.c:80           packet:        fetch> shallow f59eed49cafc1b986a593a153714d3896c194a65
12:35:07.811753 pkt-line.c:80           packet:        fetch> deepen 10
12:35:07.811758 pkt-line.c:80           packet:        fetch> 0000
12:35:08.108127 pkt-line.c:80           packet:        fetch< shallow c047fc14746739e9f52cd20a71fc60cf31f63a42
12:35:08.108208 pkt-line.c:80           packet:        fetch< unshallow 9301f4e3a16df8e7cf8f37b5b93a7b925d8c8bee
fatal: error in object: unshallow 9301f4e3a16df8e7cf8f37b5b93a7b925d8c8bee

I'm using:

% /bin/git --version
git version 2.28.0
Tom Hale
  • 40,825
  • 36
  • 187
  • 242

1 Answers1

8

FWIW : I can reproduce your issue when cloning that repo.

I ran git repack -aldf (mentioned in the question you linked) once on my clone, and it made my next git fetch --unshallow work.

Poking around a bit : git repack -d was enough to fix the issue.

I don't get all the implications behind git repack command I ran ; I think you can submit this precise issue to git's mailing list.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • 2
    It's clearly a bug in Git, but where exactly the bug *is*, is much more mysterious. The reproducer and trace data will be useful. – torek Sep 14 '20 at 07:23
  • 1
    Had the same error message "fatal: error in object: unshallow .." locally, which appears when using `git fetch --shallow-since="earlier date"` here. This was also addressed with a `git repack -d` enough though it reports "Nothing new to pack". On git version 2.31.1.windows.1. – user2864740 Apr 07 '21 at 19:29
  • Fwiw, just had a user with the same issue on Git 2.41.0.windows.1, fix worked the same way (`git repack -d`), very mysterious... – Tao Aug 09 '23 at 15:32