diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:20:10 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:20:10 +0200 |
commit | f87c456e8ac1fa341f1c3a618798738245bf8adb (patch) | |
tree | aea809e7598d0d2c4655d00783b9e7d7d1d64ed0 /org.eclipse.jgit | |
parent | 6456059795c951f2b9261d50dc33d5902a5fbb87 (diff) | |
parent | cdf35e8ead7a6a25290b7fce89007b08c6011924 (diff) | |
download | jgit-f87c456e8ac1fa341f1c3a618798738245bf8adb.tar.gz jgit-f87c456e8ac1fa341f1c3a618798738245bf8adb.zip |
Merge branch 'stable-6.3' into stable-6.4
* stable-6.3:
[bazel] Move ToolTestCase to src folder (6.2)
GcConcurrentTest: @Ignore flaky testInterruptGc
Fix CommitTemplateConfigTest
Fix after_open config and Snapshotting RefDir tests to work with bazel
[bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
Demote severity of some error prone bug patterns to warnings
UploadPack: Fix NPE when traversing a tag chain
Change-Id: I463f8528e623316add204848d551c44d44d04858
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 27 |
1 files changed, 14 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 a7ce1d7c21..9b40dfea19 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2437,11 +2437,11 @@ public class UploadPack implements Closeable { if (peeledId == null || objectId == null) continue; - objectId = ref.getObjectId(); - if (pw.willInclude(peeledId) && !pw.willInclude(objectId)) { - RevObject o = rw.parseAny(objectId); - addTagChain(o, pw); - pw.addObject(o); + if (pw.willInclude(peeledId)) { + // We don't need to handle parseTag throwing an + // IncorrectObjectTypeException as we only reach + // here when ref is an annotated tag + addTagChain(rw.parseTag(objectId), pw); } } } @@ -2491,15 +2491,16 @@ public class UploadPack implements Closeable { } private void addTagChain( - RevObject o, PackWriter pw) throws IOException { - while (Constants.OBJ_TAG == o.getType()) { - RevTag t = (RevTag) o; - o = t.getObject(); - if (o.getType() == Constants.OBJ_TAG && !pw.willInclude(o.getId())) { - walk.parseBody(o); - pw.addObject(o); + RevTag tag, PackWriter pw) throws IOException { + RevObject o = tag; + do { + tag = (RevTag) o; + walk.parseBody(tag); + if (!pw.willInclude(tag.getId())) { + pw.addObject(tag); } - } + o = tag.getObject(); + } while (Constants.OBJ_TAG == o.getType()); } private List<ObjectId> parseDeepenNots(List<String> deepenNots) |