diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2018-12-24 12:09:39 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-12-24 12:09:39 +0100 |
commit | 4ad74d2f9ba241451ac6ba6a1bc0bb28ec4a9006 (patch) | |
tree | f1fbd386e51d17826f18b3e77c994f43de5e17b9 | |
parent | 926a126f72e997d47be26306f50924d378ca0e8c (diff) | |
parent | ce76f773f8207e5ceeb87d8f3da334c1e6295ad5 (diff) | |
download | jgit-4ad74d2f9ba241451ac6ba6a1bc0bb28ec4a9006.tar.gz jgit-4ad74d2f9ba241451ac6ba6a1bc0bb28ec4a9006.zip |
Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
Prepare 4.5.6-SNAPSHOT builds
JGit v4.5.5.201812240535-r
Call AdvertiseRefsHook before validating wants
Change-Id: I0fd67ddd9c4966c20d82cdfe78b2f9d4898b4665
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 22 |
1 files changed, 9 insertions, 13 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 201fb18740..b1cc5ded54 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -82,7 +82,6 @@ import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefDatabase; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.AsyncRevObjectQueue; import org.eclipse.jgit.revwalk.DepthWalk; @@ -707,8 +706,14 @@ public class UploadPack { } private Map<String, Ref> getAdvertisedOrDefaultRefs() throws IOException { - if (refs == null) - setAdvertisedRefs(db.getRefDatabase().getRefs(RefDatabase.ALL)); + if (refs != null) { + return refs; + } + + advertiseRefsHook.advertiseRefs(this); + if (refs == null) { + setAdvertisedRefs(db.getRefDatabase().getRefs(ALL)); + } return refs; } @@ -867,15 +872,7 @@ public class UploadPack { */ public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { - try { - advertiseRefsHook.advertiseRefs(this); - } catch (ServiceMayNotContinueException fail) { - if (fail.getMessage() != null) { - adv.writeOne("ERR " + fail.getMessage()); //$NON-NLS-1$ - fail.setOutput(); - } - throw fail; - } + Map<String, Ref> advertisedOrDefaultRefs = getAdvertisedOrDefaultRefs(); adv.init(db); adv.advertiseCapability(OPTION_INCLUDE_TAG); @@ -900,7 +897,6 @@ public class UploadPack { adv.advertiseCapability(OPTION_ALLOW_REACHABLE_SHA1_IN_WANT); adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.setDerefTags(true); - Map<String, Ref> advertisedOrDefaultRefs = getAdvertisedOrDefaultRefs(); findSymrefs(adv, advertisedOrDefaultRefs); advertised = adv.send(advertisedOrDefaultRefs); if (adv.isEmpty()) |