{"thread":{"id":"61527","subject":"Unable to shallow fetch repository when using a object database populated by shallow fetches.","startedAt":"2024-05-22T06:27:30Z","lastAt":"2024-05-22T06:27:30Z","messageCount":1,"participants":["Zopolis4"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"495264","messageId":"CAEYL+X_R_0wfaP3UR2eDaBkaGXDAi_wSo=t9xK2DgiCm3+T6HQ@mail.gmail.com","threadId":"61527","inReplyTo":null,"subject":"Unable to shallow fetch repository when using a object database populated by shallow fetches.","fromName":"Zopolis4","fromEmail":"creatorsmithmdt@gmail.com","sentAt":"2024-05-22T06:27:19Z","receivedAt":"2024-05-22T06:27:30Z","isPatch":false,"sender":{"key":"creatorsmithmdt@gmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\nCreate cache directory:\ncd /tmp\nmkdir cache\ncd cache\ngit init --bare\ngit config --local receive.shallowUpdate true\nexport GIT_ALTERNATE_OBJECT_DIRECTORIES=/tmp/cache/objects\n\nPopulate cache with shallow repository:\ncd /tmp\nmkdir repo1\ncd repo1\ngit init\ngit fetch --depth 1 https://github.com/crystal-lang/crystal\ngit checkout FETCH_HEAD\ngit push /tmp/cache HEAD:refs/heads/crystal\n\nAttempt to shallow fetch other unrelated repository:\ncd /tmp\nmkdir broken\ncd broken\ngit init\ngit fetch --depth 1 https://github.com/mint-lang/mint\n\nWhat did you expect to happen? (Expected behavior)\nThe mint repository to successfully fetch.\n\nWhat happened instead? (Actual behavior)\n\nInitialized empty Git repository in /tmp/broken/.git/\nerror: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e\nremote: Enumerating objects: 1759, done.\nremote: Counting objects: 100% (1759/1759), done.\nremote: Compressing objects: 100% (1325/1325), done.\nremote: Total 1759 (delta 645), reused 833 (delta 416), pack-reused 0\nReceiving objects: 100% (1759/1759), 678.36 KiB | 6.22 MiB/s, done.\nResolving deltas: 100% (645/645), done.\nerror: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e\nfatal: Failed to traverse parents of commit\nb563cbacb3ab1af88f4ba48c1877eb3823f3a69d\nerror: remote did not send all necessary objects\n\nWhat's different between what you expected and what actually happened?\n\nFetching the mint repository failed rather than succeeding.\n\nAnything else you want to add:\n\nIf the final command is replaced with 'git fetch\nhttps://github.com/mint-lang/mint', errors are thrown but the fetch\ncompletes successfully.\nInitialized empty Git repository in /tmp/broken/.git/\nerror: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e\nremote: Enumerating objects: 19928, done.\nremote: Counting objects: 100% (5185/5185), done.\nremote: Compressing objects: 100% (1519/1519), done.\nremote: Total 19928 (delta 4223), reused 3674 (delta 3666), pack-reused 14743\nReceiving objects: 100% (19928/19928), 4.17 MiB | 4.54 MiB/s, done.\nResolving deltas: 100% (14600/14600), done.\nFrom https://github.com/mint-lang/mint\n * branch              HEAD       -> FETCH_HEAD\n\nAlso, when the command to fetch the crystal repository is replaced\nwith 'git fetch https://github.com/crystal-lang/crystal', everything\nworks without issue.\n\nPresumably, this means the issue lies in shallow fetching when using a\nshallow object database, as making either of these non-shallow means\nthe fetch completes successfully. (Admittedly, errors are still thrown\nif a non-shallow fetch is performed using a shallow object database)\n\nI was also able to reproduce the issue on git 2.45.1, but using the\nsatmandu/crewbuild:amd64 docker container as I do not have access to\ngit 2.45.1 on debian sid.\n\n\n[System Info]\ngit version:\ngit version 2.43.0\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 6.8.9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.8.9-1\n(2024-05-15) x86_64\ncompiler info: gnuc: 13.2\nlibc info: glibc: 2.38\n$SHELL (typically, interactive shell): /usr/bin/fish\n\n\n[Enabled Hooks]\n"}]}