Unable to shallow fetch repository when using a object database populated by shallow fetches.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What did you do before the bug happened? (Steps to reproduce your issue)
Create cache directory:
cd /tmp
mkdir cache
cd cache
git init --bare
git config --local receive.shallowUpdate true
export GIT_ALTERNATE_OBJECT_DIRECTORIES=/tmp/cache/objects

Populate cache with shallow repository:
cd /tmp
mkdir repo1
cd repo1
git init
git fetch --depth 1 https://github.com/crystal-lang/crystal
git checkout FETCH_HEAD
git push /tmp/cache HEAD:refs/heads/crystal

Attempt to shallow fetch other unrelated repository:
cd /tmp
mkdir broken
cd broken
git init
git fetch --depth 1 https://github.com/mint-lang/mint

What did you expect to happen? (Expected behavior)
The mint repository to successfully fetch.

What happened instead? (Actual behavior)

Initialized empty Git repository in /tmp/broken/.git/
error: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e
remote: Enumerating objects: 1759, done.
remote: Counting objects: 100% (1759/1759), done.
remote: Compressing objects: 100% (1325/1325), done.
remote: Total 1759 (delta 645), reused 833 (delta 416), pack-reused 0
Receiving objects: 100% (1759/1759), 678.36 KiB | 6.22 MiB/s, done.
Resolving deltas: 100% (645/645), done.
error: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e
fatal: Failed to traverse parents of commit
b563cbacb3ab1af88f4ba48c1877eb3823f3a69d
error: remote did not send all necessary objects

What's different between what you expected and what actually happened?

Fetching the mint repository failed rather than succeeding.

Anything else you want to add:

If the final command is replaced with 'git fetch
https://github.com/mint-lang/mint', errors are thrown but the fetch
completes successfully.
Initialized empty Git repository in /tmp/broken/.git/
error: Could not read 2ac4b3fb4325328d347344ae738bb38d4675b82e
remote: Enumerating objects: 19928, done.
remote: Counting objects: 100% (5185/5185), done.
remote: Compressing objects: 100% (1519/1519), done.
remote: Total 19928 (delta 4223), reused 3674 (delta 3666), pack-reused 14743
Receiving objects: 100% (19928/19928), 4.17 MiB | 4.54 MiB/s, done.
Resolving deltas: 100% (14600/14600), done.
>From https://github.com/mint-lang/mint
 * branch              HEAD       -> FETCH_HEAD

Also, when the command to fetch the crystal repository is replaced
with 'git fetch https://github.com/crystal-lang/crystal', everything
works without issue.

Presumably, this means the issue lies in shallow fetching when using a
shallow object database, as making either of these non-shallow means
the fetch completes successfully. (Admittedly, errors are still thrown
if a non-shallow fetch is performed using a shallow object database)

I was also able to reproduce the issue on git 2.45.1, but using the
satmandu/crewbuild:amd64 docker container as I do not have access to
git 2.45.1 on debian sid.


[System Info]
git version:
git version 2.43.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.8.9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.8.9-1
(2024-05-15) x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.38
$SHELL (typically, interactive shell): /usr/bin/fish


[Enabled Hooks]




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux