Commit 5478cf3c authored by Petar Perisin's avatar Petar Perisin
Browse files

Git - bugFix in submoduleList

it looks like submodule list in git config does not return paths. that
is why I have direct reading of .gitmodules file now.

Change-Id: I7f441d0b2e31ad7b73fbc8c05e5c9a9e0c84036c
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <>
parent 895b89db
......@@ -1574,33 +1574,22 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
return result;
QMap<QString,QString> GitClient::synchronousSubmoduleList(const QString &workingDirectory,
QString *errorMessage)
// function returns submodules in format path=url
QMap<QString,QString> GitClient::synchronousSubmoduleList(const QString &workingDirectory)
QStringList args;
QMap<QString,QString> result;
args << QLatin1String("config") << QLatin1String("-l");
QByteArray outputText;
QByteArray errorText;
const bool rc = fullySynchronousGit(workingDirectory, args, &outputText, &errorText);
if (!rc) {
QString message = msgCannotRun(QLatin1String("git config -l"), workingDirectory, commandOutputFromLocal8Bit(errorText));
if (errorMessage)
*errorMessage = message;
if (!QFile::exists(workingDirectory + QLatin1String("/.gitmodules")))
return result;
QStringList outputList = commandOutputLinesFromLocal8Bit(outputText);
QString urlKey = QLatin1String(".url=");
foreach (const QString& line, outputList) {
if (line.startsWith(QLatin1String("submodule."))) {
result.insertMulti(line.mid(10, line.indexOf(urlKey) - 10),
line.mid(line.indexOf(urlKey, 10) + 5));
QSettings gitmodulesFile(workingDirectory + QLatin1String("/.gitmodules"), QSettings::IniFormat);
foreach (const QString &submoduleGroup, gitmodulesFile.childGroups()) {
return result;
......@@ -198,8 +198,7 @@ public:
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
QString *errorMessage = 0);
QMap<QString,QString> synchronousSubmoduleList(const QString &workingDirectory,
QString *errorMessage = 0);
QMap<QString,QString> synchronousSubmoduleList(const QString &workingDirectory);
bool synchronousShow(const QString &workingDirectory, const QString &id,
QString *output, QString *errorMessage);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment