aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2017-10-19 16:58:07 -0400
committerMatthias Sohn <matthias.sohn@sap.com>2017-12-27 22:55:54 +0100
commit4bbc74ba407e95954bb444df456d37a21363ce6c (patch)
tree886bed2177a029dd83ff0dd2eebccc977f6f5e23 /org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
parent658486386648f186ed8ce934e0abf4d999252a67 (diff)
downloadjgit-4bbc74ba407e95954bb444df456d37a21363ce6c.tar.gz
jgit-4bbc74ba407e95954bb444df456d37a21363ce6c.zip
Use submodule name instead of path as key in config
When a submodule is moved, the "name" field remains the same, while the "path" field changes. Git uses the "name" field in .git/config when a submodule is initialized, so this patch makes JGit do so too. Change-Id: I48d8e89f706447b860c0162822a8e68170aae42b Signed-off-by: David Turner <dturner@twosigma.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
index acca029835..6af27d704c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
@@ -110,16 +110,17 @@ public class SubmoduleInitCommand extends GitCommand<Collection<String>> {
continue;
String path = generator.getPath();
+ String name = generator.getModuleName();
// Copy 'url' and 'update' fields from .gitmodules to config
// file
String url = generator.getRemoteUrl();
String update = generator.getModulesUpdate();
if (url != null)
config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_URL, url);
+ name, ConfigConstants.CONFIG_KEY_URL, url);
if (update != null)
config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
- path, ConfigConstants.CONFIG_KEY_UPDATE, update);
+ name, ConfigConstants.CONFIG_KEY_UPDATE, update);
if (url != null || update != null)
initialized.add(path);
}