diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 49713eb22dce943fe953321c918cc7607195fe04..c8062134dad286c458a9ca9dfd2ea78d0465eba4 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1408,8 +1408,12 @@ QProcessEnvironment GitClient::processEnvironment() const { QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - if (settings()->boolValue(GitSettings::adoptPathKey)) - environment.insert(QLatin1String("PATH"), settings()->stringValue(GitSettings::pathKey)); + QString gitPath = settings()->stringValue(GitSettings::pathKey); + if (!gitPath.isEmpty()) { + gitPath += Utils::SynchronousProcess::pathSeparator(); + gitPath += environment.value(QLatin1String("PATH")); + environment.insert(QLatin1String("PATH"), gitPath); + } #ifdef Q_OS_WIN if (settings()->boolValue(GitSettings::winSetHomeEnvironmentKey)) environment.insert(QLatin1String("HOME"), QDir::toNativeSeparators(QDir::homePath())); @@ -1620,7 +1624,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env, // This should always use QProcess::startDetached (as not to kill // the child), but that does not have an environment parameter. bool success = false; - if (settings()->boolValue(GitSettings::adoptPathKey)) { + if (!settings()->stringValue(GitSettings::pathKey).isEmpty()) { QProcess *process = new QProcess(this); process->setWorkingDirectory(workingDirectory); process->setProcessEnvironment(env); diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index eae064097c91621d67f2f313ef85020e4b421bb5..31f289eb41a5985fb219966cc89a28d6486cdd01 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -39,7 +39,6 @@ namespace Git { namespace Internal { -const QLatin1String GitSettings::adoptPathKey("SysEnv"); const QLatin1String GitSettings::pathKey("Path"); const QLatin1String GitSettings::pullRebaseKey("PullRebase"); const QLatin1String GitSettings::omitAnnotationDateKey("OmitAnnotationDate"); @@ -61,7 +60,6 @@ GitSettings::GitSettings() #else declareKey(timeoutKey, 30); #endif - declareKey(adoptPathKey, false); declareKey(pathKey, QString()); declareKey(pullRebaseKey, false); declareKey(omitAnnotationDateKey, false); @@ -87,7 +85,7 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const const QString binary = stringValue(binaryPathKey); QString currentPath = stringValue(pathKey); // Easy, git is assumed to be elsewhere accessible - if (!boolValue(adoptPathKey)) + if (currentPath.isEmpty()) currentPath = QString::fromLocal8Bit(qgetenv("PATH")); // Search in path? m_binaryPath = Utils::SynchronousProcess::locateBinary(currentPath, binary); diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 5e7f09a6aea0c636cab8e8b88a6204b64979933f..e0c629ed74efd81b8245357e98e90205a00565fc 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -46,7 +46,6 @@ class GitSettings : public VcsBase::VcsBaseClientSettings public: GitSettings(); - static const QLatin1String adoptPathKey; static const QLatin1String pathKey; static const QLatin1String pullRebaseKey; static const QLatin1String omitAnnotationDateKey; diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index 9ca95854a75c5629aaae9dca6d609c3f6f2554bb..e8ec9381bb6e076b2aeb3368eec919c64cd497fc 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -52,7 +52,6 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) { m_ui.setupUi(this); - connect(m_ui.adoptButton, SIGNAL(clicked()), this, SLOT(setSystemPath())); #ifdef Q_OS_WIN const QByteArray currentHome = qgetenv("HOME"); const QString toolTip @@ -72,8 +71,6 @@ GitSettings SettingsPageWidget::settings() const { GitSettings rc; rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text()); - rc.setValue(GitSettings::adoptPathKey, m_ui.environmentGroupBox->isChecked() - && !rc.stringValue(GitSettings::pathKey).isEmpty()); rc.setValue(GitSettings::logCountKey, m_ui.logCountSpinBox->value()); rc.setValue(GitSettings::timeoutKey, m_ui.timeoutSpinBox->value()); rc.setValue(GitSettings::pullRebaseKey, m_ui.pullRebaseCheckBox->isChecked()); @@ -85,7 +82,6 @@ GitSettings SettingsPageWidget::settings() const void SettingsPageWidget::setSettings(const GitSettings &s) { - m_ui.environmentGroupBox->setChecked(s.boolValue(GitSettings::adoptPathKey)); m_ui.pathLineEdit->setText(s.stringValue(GitSettings::pathKey)); m_ui.logCountSpinBox->setValue(s.intValue(GitSettings::logCountKey)); m_ui.timeoutSpinBox->setValue(s.intValue(GitSettings::timeoutKey)); @@ -95,17 +91,11 @@ void SettingsPageWidget::setSettings(const GitSettings &s) m_ui.gitkOptionsLineEdit->setText(s.stringValue(GitSettings::gitkOptionsKey)); } -void SettingsPageWidget::setSystemPath() -{ - m_ui.pathLineEdit->setText(QLatin1String(qgetenv("PATH"))); -} - QString SettingsPageWidget::searchKeywords() const { QString rc; QLatin1Char sep(' '); QTextStream(&rc) - << sep << m_ui.environmentGroupBox->title() << sep << m_ui.pathlabel->text() << sep << m_ui.winHomeCheckBox->text() << sep << m_ui.groupBox->title() diff --git a/src/plugins/git/settingspage.h b/src/plugins/git/settingspage.h index bea67087d9dc7d021ab5ceb71b7cdbea018e4254..8a482e412642f033a8f468e7d0e32ba28455a996 100644 --- a/src/plugins/git/settingspage.h +++ b/src/plugins/git/settingspage.h @@ -59,9 +59,6 @@ public: QString searchKeywords() const; -private slots: - void setSystemPath(); - private: Ui::SettingsPage m_ui; }; diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index 08b98fa2a34de8bfb5e33abaa88502a47f075686..2453404c749c3e0c856af77847ce470536c8a1ec 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -12,34 +12,24 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QGroupBox" name="environmentGroupBox"> + <widget class="QGroupBox" name="configurationGroupBox"> <property name="enabled"> <bool>true</bool> </property> <property name="title"> - <string>Customize Environment:</string> - </property> - <property name="checkable"> - <bool>true</bool> + <string>Configuration</string> </property> <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> <widget class="QLabel" name="pathlabel"> <property name="text"> - <string>PATH:</string> + <string>Prepend to PATH:</string> </property> </widget> </item> <item row="0" column="1"> <widget class="QLineEdit" name="pathLineEdit"/> </item> - <item row="0" column="2"> - <widget class="QPushButton" name="adoptButton"> - <property name="text"> - <string>From System</string> - </property> - </widget> - </item> <item row="1" column="0" colspan="3"> <widget class="QCheckBox" name="winHomeCheckBox"> <property name="text">