diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2022-10-04 15:42:25 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-01-31 23:52:20 +0100 |
commit | 76508320025a2258ccf169de2f559ad01f27281b (patch) | |
tree | 56c3b5fe96bfb47bac2f577f28d3919a71d394f2 /org.eclipse.jgit/src/org/eclipse | |
parent | 8040936f8aee4f0637339ab7c1dcfc56fe612cff (diff) | |
download | jgit-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.java | 3 |
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()) { |