diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:30:20 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:30:20 +0200 |
commit | 34a81889b8d8a6e84ffaf86deca8eb15bfb250ab (patch) | |
tree | 6ed312f660d52ddc3a02fec2bab9dda734b1704e /org.eclipse.jgit | |
parent | 032eef5b12a25e0da48004eea589966ae0652433 (diff) | |
parent | f87c456e8ac1fa341f1c3a618798738245bf8adb (diff) | |
download | jgit-34a81889b8d8a6e84ffaf86deca8eb15bfb250ab.tar.gz jgit-34a81889b8d8a6e84ffaf86deca8eb15bfb250ab.zip |
Merge branch 'stable-6.4' into stable-6.5
* stable-6.4:
[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: I6d20fea3a417e4361b61e81756253343668eb5de
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 b648706475..f245eae39f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2444,11 +2444,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); } } } @@ -2498,15 +2498,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) |