summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-04-27 02:07:23 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2023-04-27 02:08:05 +0200
commitcdf35e8ead7a6a25290b7fce89007b08c6011924 (patch)
treee3d626e5742457946c01317fda03edddbdb17563 /org.eclipse.jgit
parent76aa6f284095f76fb96169c44bb0a0abd2eb8e40 (diff)
parent9932f9b4156349252d3516a06298e3db708f4d5a (diff)
downloadjgit-cdf35e8ead7a6a25290b7fce89007b08c6011924.tar.gz
jgit-cdf35e8ead7a6a25290b7fce89007b08c6011924.zip
Merge branch 'stable-6.2' into stable-6.3
* stable-6.2: [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: I736c7d0ed9c6e9718fa98976c3dc5a25ab8cda85
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java27
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 65dbf12b2f..d2a2a97d0a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -2417,11 +2417,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);
}
}
}
@@ -2471,15 +2471,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)