diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-28 19:51:01 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-28 19:51:01 +0200 |
commit | 4d9db14a5e31cd87128a059d96408062c0289040 (patch) | |
tree | b2bf109013f2a516375d77b9daff77d3663a0cd3 /org.eclipse.jgit | |
parent | f9f3389847c46b6d6df946814db796b4480970b5 (diff) | |
parent | 34a81889b8d8a6e84ffaf86deca8eb15bfb250ab (diff) | |
download | jgit-4d9db14a5e31cd87128a059d96408062c0289040.tar.gz jgit-4d9db14a5e31cd87128a059d96408062c0289040.zip |
Merge branch 'stable-6.5'
* stable-6.5:
[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
Parse pull.rebase=preserve as alias for pull.rebase=merges
UploadPack: Fix NPE when traversing a tag chain
Change-Id: I16e8553d187a8ef541f578291f47fc39c3da4ac0
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java | 7 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 27 |
2 files changed, 20 insertions, 14 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java index 19495dff1f..e15c7af932 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java @@ -35,7 +35,12 @@ public class BranchConfig { * * @since 6.5 used instead of deprecated "preserve" option */ - MERGES("merges"), //$NON-NLS-1$ + MERGES("merges"){ //$NON-NLS-1$ + @Override + public boolean matchConfigValue(String s) { + return super.matchConfigValue(s) || "preserve".equals(s); //$NON-NLS-1$ + } + }, /** Value for rebasing interactively */ INTERACTIVE("interactive"), //$NON-NLS-1$ /** Value for not rebasing at all but merging */ 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) |