eclipse-jgit / jgit

JGit, the Java implementation of git
https://www.eclipse.org/jgit/
Other
92 stars 31 forks source link

JGit stops reporting allow-tip-sha1-in-want and/or allow-reachable-sha1-in-want once uploadpack.allowAnySHA1InWant is enabled #68

Open pszlazak opened 1 week ago

pszlazak commented 1 week ago

Version

v6.9.0.202403050737-r-23-gc0b415fb0 (bundled with Gerrit 3.10.0)

Operating System

Linux/Unix

Bug description

JGit properly advertises following capabilities if following options are enabled:

  1. allow-tip-sha1-in-want if uploadpack.allowTipSHA1InWant is enabled
  2. allow-reachable-sha1-in-want if uploadpack.allowReachableSHA1InWant is enabled
  3. allow-tip-sha1-in-want and allow-reachable-sha1-in-want if both options are enabled

When uploadpack.allowAnySHA1InWant is also enabled, capabilities are no longer advertised (all are gone).

Actual behavior

If uploadpack.allowAnySHA1InWant is enabled, no allow-tip-sha1-in-want and/or allow-reachable-sha1-in-want is advertised by JGit in response for git-upload-pack request.

Expected behavior

JGit continues to report allow-XXX capabilities even if uploadpack.allowAnySHA1InWant is enabled.

Moreover - as there is not dedicated allow-any-sha1-in-want capability, if only uploadpack.allowAnySHA1InWant is enabled, other two capabilities should be advertised.

Relevant log output

Config file with allowTipSHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = true
    allowReachableSHA1InWant = false
    allowAnySHA1InWant = false

Advertised capabilities -> allow-tip-sha1-in-want visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000001082163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done allow-tip-sha1-in-want agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master
                                                                                                                                                                       ^^^^^^^^^^^^^^^^^^^^^^

Config file with allowReachableSHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = false
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = false

Advertised capabilities -> allow-reachable-sha1-in-want visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
0000010e2163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done allow-reachable-sha1-in-want agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master
                                                                                                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Config file with allowTipSHA1InWant and allowAnySHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = true
    allowReachableSHA1InWant = false
    allowAnySHA1InWant = true

Advertised capabilities -> allow-tip-sha1-in-want not visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000000f12163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master

Config file with allowReachableSHA1InWant and allowAnySHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = false
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

Advertised capabilities -> allow-reachable-sha1-in-want not visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000000f12163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master

Config file with allowTipSHA1InWant and allowReachableSHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = false

Advertised capabilities -> allow-tip-sha1-in-want and allow-reachable-sha1-in-want visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000001252163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done allow-tip-sha1-in-want allow-reachable-sha1-in-want agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master
                                                                                                                                                                       ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Config file with allowTipSHA1InWant, allowReachableSHA1InWant and allowAnySHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

Advertised capabilities -> allow-tip-sha1-in-want and allow-reachable-sha1-in-want not visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000000f12163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master

Config file with only allowAnySHA1InWant enabled (only relevant options are shown):

[uploadpack]
    allowTipSHA1InWant = false
    allowReachableSHA1InWant = false
    allowAnySHA1InWant = true

Advertised capabilities -> allow-tip-sha1-in-want and allow-reachable-sha1-in-want not visible:

$ curl -s http://localhost:8080/Test-project/info/refs?service=git-upload-pack -o - | head -2
001e# service=git-upload-pack
000000f12163515068449cf60cb0321bef5adf0e72bdd7db HEAD include-tag multi_ack_detailed multi_ack ofs-delta side-band side-band-64k thin-pack no-progress shallow no-done agent=JGit/v6.9.0.202403050737-r-23-gc0b415fb0 symref=HEAD:refs/heads/master

Other information

Tested with Gerrit 3.10.0