Commit 7a7117cd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Undo changes on pull with rebase when user chooses not to stash

Task-number: QTCREATORBUG-7031

Change-Id: I10bee004482bf8f066f1ddfcf720797e8005ebec
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent fba41063
......@@ -958,22 +958,25 @@ void GitPlugin::pull()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
QString topLevel = state.topLevel();
bool rebase = m_gitClient->settings()->boolValue(GitSettings::pullRebaseKey);
if (!rebase) {
bool isDetached;
QString branchRebaseConfig = m_gitClient->synchronousRepositoryBranches(state.topLevel(), &isDetached).at(0);
QString branchRebaseConfig = m_gitClient->synchronousRepositoryBranches(topLevel, &isDetached).at(0);
if (!isDetached) {
branchRebaseConfig.prepend(QLatin1String("branch."));
branchRebaseConfig.append(QLatin1String(".rebase"));
rebase = (m_gitClient->readConfigValue(state.topLevel(), branchRebaseConfig) == QLatin1String("true"));
rebase = (m_gitClient->readConfigValue(topLevel, branchRebaseConfig) == QLatin1String("true"));
}
}
GitClient::StashGuard stashGuard(state.topLevel(), QLatin1String("Pull"));
if (stashGuard.stashingFailed(false) || (rebase && (stashGuard.result() == GitClient::NotStashed)))
GitClient::StashGuard stashGuard(topLevel, QLatin1String("Pull"));
if (stashGuard.stashingFailed(false))
return;
if (!m_gitClient->synchronousPull(state.topLevel(), rebase))
if (rebase && (stashGuard.result() == GitClient::NotStashed))
m_gitClient->synchronousCheckoutFiles(topLevel);
if (!m_gitClient->synchronousPull(topLevel, rebase))
stashGuard.preventPop();
}
......
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