|
|
@ -132,30 +132,31 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> { |
|
|
|
path, ConfigConstants.CONFIG_KEY_URL, remoteUrl); |
|
|
|
path, ConfigConstants.CONFIG_KEY_URL, remoteUrl); |
|
|
|
synced.put(path, remoteUrl); |
|
|
|
synced.put(path, remoteUrl); |
|
|
|
|
|
|
|
|
|
|
|
Repository subRepo = generator.getRepository(); |
|
|
|
try (Repository subRepo = generator.getRepository()) { |
|
|
|
if (subRepo == null) |
|
|
|
if (subRepo == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StoredConfig subConfig; |
|
|
|
|
|
|
|
String branch; |
|
|
|
|
|
|
|
|
|
|
|
StoredConfig subConfig; |
|
|
|
|
|
|
|
String branch; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
subConfig = subRepo.getConfig(); |
|
|
|
subConfig = subRepo.getConfig(); |
|
|
|
// Get name of remote associated with current branch and
|
|
|
|
// Get name of remote associated with current branch and
|
|
|
|
// fall back to default remote name as last resort
|
|
|
|
// fall back to default remote name as last resort
|
|
|
|
branch = getHeadBranch(subRepo); |
|
|
|
branch = getHeadBranch(subRepo); |
|
|
|
String remote = null; |
|
|
|
String remote = null; |
|
|
|
if (branch != null) |
|
|
|
if (branch != null) { |
|
|
|
remote = subConfig.getString( |
|
|
|
remote = subConfig.getString( |
|
|
|
ConfigConstants.CONFIG_BRANCH_SECTION, branch, |
|
|
|
ConfigConstants.CONFIG_BRANCH_SECTION, branch, |
|
|
|
ConfigConstants.CONFIG_KEY_REMOTE); |
|
|
|
ConfigConstants.CONFIG_KEY_REMOTE); |
|
|
|
if (remote == null) |
|
|
|
} |
|
|
|
|
|
|
|
if (remote == null) { |
|
|
|
remote = Constants.DEFAULT_REMOTE_NAME; |
|
|
|
remote = Constants.DEFAULT_REMOTE_NAME; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
subConfig.setString(ConfigConstants.CONFIG_REMOTE_SECTION, |
|
|
|
subConfig.setString(ConfigConstants.CONFIG_REMOTE_SECTION, |
|
|
|
remote, ConfigConstants.CONFIG_KEY_URL, remoteUrl); |
|
|
|
remote, ConfigConstants.CONFIG_KEY_URL, remoteUrl); |
|
|
|
subConfig.save(); |
|
|
|
subConfig.save(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
subRepo.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!synced.isEmpty()) |
|
|
|
if (!synced.isEmpty()) |
|
|
|