Commit 8973ef31 authored by Tobias Hunger's avatar Tobias Hunger

Git: Do not pull --rebase when changes are not stashed

Git will not do a pull --rebase when there are changes. So we
now abort if the user did not stash them instead of trying to
pull.

I do not want to revert user changes implicitly.

Task-number: QTCREATORBUG-7031
Change-Id: Ic6041755938be36d8ecdbcbac373b5c38642360d
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent d48136f3
......@@ -170,6 +170,7 @@ public:
QString vcsGetRepositoryURL(const QString &directory);
bool synchronousFetch(const QString &workingDirectory, const QString &remote);
bool synchronousPull(const QString &workingDirectory);
bool synchronousPull(const QString &workingDirectory, bool rebase);
bool synchronousPush(const QString &workingDirectory, const QString &remote = QString());
// git svn support (asynchronous).
......@@ -282,7 +283,6 @@ private:
QString *errorMessage,
bool revertStaging);
void connectRepositoryChanged(const QString & repository, VcsBase::Command *cmd);
bool synchronousPull(const QString &workingDirectory, bool rebase);
void syncAbortPullRebase(const QString &workingDir);
bool tryLauchingGitK(const QProcessEnvironment &env,
const QString &workingDirectory,
......
......@@ -794,12 +794,17 @@ void GitPlugin::pull()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
const bool rebase = m_gitClient->settings()->boolValue(GitSettings::pullRebaseKey);
switch (m_gitClient->ensureStash(state.topLevel())) {
case GitClient::StashUnchanged:
case GitClient::Stashed:
m_gitClient->synchronousPull(state.topLevel(), rebase);
break;
case GitClient::NotStashed:
m_gitClient->synchronousPull(state.topLevel());
if (!rebase)
m_gitClient->synchronousPull(state.topLevel(), false);
break;
default:
break;
}
......
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