diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-26 21:55:16 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-26 21:55:16 +0200 |
commit | 6082ae25dd92ec5f67fbbcfd00e1c244caf63f87 (patch) | |
tree | 08e8cf67021437f40b7d6a746ce000a89309b18d /org.eclipse.jgit | |
parent | e59ade2a6f88cbe18466924f76867e2cc167b233 (diff) | |
parent | 9445e42b7a79771dd69a55edacb11f30c499ae86 (diff) | |
download | jgit-6082ae25dd92ec5f67fbbcfd00e1c244caf63f87.tar.gz jgit-6082ae25dd92ec5f67fbbcfd00e1c244caf63f87.zip |
Merge branch 'stable-6.0' into stable-6.1
* stable-6.0:
[bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
Demote severity of some error prone bug patterns to warnings
UploadPack: Fix NPE when traversing a tag chain
Change-Id: I5e13d5b5414aef97e518898166bfa166c692e60f
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 1617c5063d..46abe34fa2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2405,11 +2405,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); } } } @@ -2459,15 +2459,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 static class ResponseBufferedOutputStream extends OutputStream { |