diff options
author | Marcin Czech <maczech@gmail.com> | 2021-12-22 17:42:36 +0100 |
---|---|---|
committer | Marcin Czech <maczech@gmail.com> | 2022-01-18 08:00:03 -0400 |
commit | 78d4fb1ca00149a700f586357139f08efaa29ff6 (patch) | |
tree | 14e3876a4e8021435c3fbcc98078dcf4e5bb39ec /org.eclipse.jgit/src/org | |
parent | 8a4b98376785a6c271fede00035fe89dea2b9982 (diff) | |
download | jgit-78d4fb1ca00149a700f586357139f08efaa29ff6.tar.gz jgit-78d4fb1ca00149a700f586357139f08efaa29ff6.zip |
UploadPack v2 protocol: Stop negotiation for orphan refs
The fetch of a single orphan ref (for example Gerrit meta ref:
refs/changes/21/21/meta) did not stop the negotiation so client
had to advertise all refs. This impacts the fetch performance
on repositories with a large number of refs (for example on
Gerrit repository it takes 20 seconds to fetch meta ref
comparing to 1.2 second to fetch ref with parent).
To avoid this issue UploadPack, used on the server side,
now checks if all `want` refs have parents, if not this
means that client doesn't need any extra objects, hence
the server responds with `ready` and finishes the
negotiation phase.
Bug: 577937
Change-Id: Ia3001b400b415d5cf6aae45e72345ca08d3af058
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 9fda639280..63deff2d9e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2103,6 +2103,11 @@ public class UploadPack { if (want.has(SATISFIED)) return true; + if (((RevCommit) want).getParentCount() == 0) { + want.add(SATISFIED); + return true; + } + walk.resetRetain(SAVE); walk.markStart((RevCommit) want); if (oldestTime != 0) |