Not able to enable allowTipSHA1InWant and allowAnySHA1InWant

227 views
Skip to first unread message

Piotr Szlązak

unread,
Jul 4, 2024, 10:18:16 AM7/4/24
to Repo and Gerrit Discussion
Hello!
I'm testing on Gerrit 3.10.0.
I created test repo where I have more than one commit in master branch and additionally separate test-branch with extra commit.

I added following options to $site_path/etc/jgit.config:
[uploadpack]
    hideRefs = refs/heads/test-branch
    allowAnySha1InWant = true
    allowTipSHA1InWant = true

But also was trying to add them to $site_path/git/Test-project.git/config.

I trying to fetch arbitrary object but it fails:
$ git -c protocol.version=0 fetch http://localhost:8080/Test-project.git full-sha1-of-older-commit-in-master-branch
error: Server does not allow request for unadvertised object full-sha1-of-older-commit-in-master-branch

$ git -c protocol.version=0 fetch http://localhost:8080/Test-project.git full-sha1-of-tip-of-hidden-test-branch
error: Server does not allow request for unadvertised object full-sha1-of-tip-of-hidden-test-branch

Yet uploadpack.hideRefs is effective as I don't see test-branch in output of 'git ls-remote'. When uploadpack.hideRefs is removed, I can see it.

If I switch to Git V2 protocol, I can fetch mentioned SHA1s. But I want to be able to fetch arbitrary objects using V0 / V1 Git protocol.

Regards!
-- 
Piotr

Piotr Szlązak

unread,
Jul 8, 2024, 10:56:12 AM7/8/24
to Repo and Gerrit Discussion
On Thursday, July 4, 2024 at 4:18:16 PM UTC+2 Piotr Szlązak wrote:
I trying to fetch arbitrary object but it fails:
$ git -c protocol.version=0 fetch http://localhost:8080/Test-project.git full-sha1-of-older-commit-in-master-branch
error: Server does not allow request for unadvertised object full-sha1-of-older-commit-in-master-branch

$ git -c protocol.version=0 fetch http://localhost:8080/Test-project.git full-sha1-of-tip-of-hidden-test-branch
error: Server does not allow request for unadvertised object full-sha1-of-tip-of-hidden-test-branch

Hello! 
error: Server does not allow request for unadvertised object full-sha1-of-older-commit-in-master-branch
is client side error message:
It is reported when there is no allow-tip-sha1-in-want and/or allow-reachable-sha1-in-want capability advertised by the server.
Looks like JGit stops to advertise those capabilities once uploadpack.allowAnySHA1InWant is enabled. Without it, Gerrit advertises them properly if uploadpack.allowTipSHA1InWant and/or uploadpack.allowReachableSHA1InWant is enabled.
I created JGit bug report for this: https://github.com/eclipse-jgit/jgit/issues/68

Regards!
-- 
Piotr

Piotr Szlązak

unread,
Jan 16, 2025, 5:46:36 AMJan 16
to Repo and Gerrit Discussion
On Monday, July 8, 2024 at 4:56:12 PM UTC+2 Piotr Szlązak wrote:

I created JGit bug report for this: https://github.com/eclipse-jgit/jgit/issues/68

Issue is fixed now. Fix is available in Gerrit 3.9.9, 3.10.4 and 3.11.1.

Regards!
-- 
Piotr
Reply all
Reply to author
Forward
0 new messages