diff options
author | Ivan Frade <ifrade@google.com> | 2024-05-30 14:04:56 -0700 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-07-08 14:04:56 +0200 |
commit | 784f0baecbbb68f1e136efe862087634d10826eb (patch) | |
tree | 53ff701ce55d9b564873d2d436489d4d8f2bce26 /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | e5534111577b0f9c9b50140461adea31f789c06c (diff) | |
download | jgit-784f0baecbbb68f1e136efe862087634d10826eb.tar.gz jgit-784f0baecbbb68f1e136efe862087634d10826eb.zip |
RepoCommand: Copy manifest upstream into .gitmodules ref field
Project entries in the manifest with a specific sha1 as revision can
use the "upstream" field to report the ref pointing to that sha1. This
information is very valuable for downstream tools, as they can limit
their search for a blob to the relevant ref, but it gets lost in the
translation to .gitmodules.
Save the value of the upstream field when available/relevant in the
ref field of the .gitmodules entry.
Change-Id: I14a2395925618d5e6b34be85466e32f5ef8fbf6e
(cherry picked from commit 48465f84014904edddcdd48258c67bc19555d4c3)
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java | 3 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java index 3ce97a4ff7..d191e23399 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java @@ -156,6 +156,9 @@ class BareSuperprojectWriter { ObjectId objectId; if (ObjectId.isId(proj.getRevision())) { objectId = ObjectId.fromString(proj.getRevision()); + if (config.recordRemoteBranch && proj.getUpstream() != null) { + cfg.setString("submodule", name, "ref", proj.getUpstream()); + } } else { objectId = callback.sha1(url, proj.getRevision()); if (objectId == null && !config.ignoreRemoteFailures) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index 95c1c8b22e..3aaef387f9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -615,6 +615,7 @@ public class RepoCommand extends GitCommand<RevCommit> { p.setUrl(proj.getUrl()); p.addCopyFiles(proj.getCopyFiles()); p.addLinkFiles(proj.getLinkFiles()); + p.setUpstream(proj.getUpstream()); ret.add(p); } } |