aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2022-10-04 15:42:25 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2023-01-31 23:52:20 +0100
commit76508320025a2258ccf169de2f559ad01f27281b (patch)
tree56c3b5fe96bfb47bac2f577f28d3919a71d394f2 /org.eclipse.jgit/src/org/eclipse
parent8040936f8aee4f0637339ab7c1dcfc56fe612cff (diff)
downloadjgit-76508320025a2258ccf169de2f559ad01f27281b.tar.gz
jgit-76508320025a2258ccf169de2f559ad01f27281b.zip
FetchCommand: fix fetchSubmodules to work on a Ref to a blob
FetchCommand#fetchSubmodules assumed that FETCH_HEAD can always be parsed as a tree. This isn't true if it refers to a Ref referring to a BLOB. This is e.g. used in Gerrit for Refs like refs/sequences/changes which are used to implement sequences stored in git. Change-Id: I414f5b7d9f2184b2d7d53af1dfcd68cccb725ca4
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
index 90c1515b06..7290d83df0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
@@ -140,6 +140,9 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
if (fetchHead == null) {
return;
}
+ if (revWalk.parseAny(fetchHead).getType() == Constants.OBJ_BLOB) {
+ return;
+ }
walk.setTree(revWalk.parseTree(fetchHead));
while (walk.next()) {
try (Repository submoduleRepo = walk.getRepository()) {