Git: Support stash --keep-index

Task-number: QTCREATORBUG-13587
Change-Id: I23f62b961df73872ae980d95b91a3285c0e367c1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-02-04 22:39:00 +02:00
committed by Orgad Shaneh
parent c9df079885
commit 42e0ea62f6
4 changed files with 22 additions and 6 deletions

View File

@@ -1773,10 +1773,13 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri
bool GitClient::executeSynchronousStash(const QString &workingDirectory,
const QString &message,
bool unstagedOnly,
QString *errorMessage) const
{
QStringList arguments;
arguments << QLatin1String("stash") << QLatin1String("save");
if (unstagedOnly)
arguments << QLatin1String("--keep-index");
if (!message.isEmpty())
arguments << message;
const unsigned flags = VcsBasePlugin::ShowStdOutInLogWindow
@@ -3530,8 +3533,9 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
} else if (msgBox.clickedButton() == cancelButton) {
m_stashResult = StashCanceled;
} else if (msgBox.clickedButton() == stashButton) {
m_stashResult = m_client->executeSynchronousStash(m_workingDir,
creatorStashMessage(command), errorMessage) ? StashUnchanged : StashFailed;
const bool result = m_client->executeSynchronousStash(
m_workingDir, creatorStashMessage(command), false, errorMessage);
m_stashResult = result ? StashUnchanged : StashFailed;
} else if (msgBox.clickedButton() == stashAndPopButton) {
executeStash(command, errorMessage);
}
@@ -3540,7 +3544,7 @@ void GitClient::StashInfo::stashPrompt(const QString &command, const QString &st
void GitClient::StashInfo::executeStash(const QString &command, QString *errorMessage)
{
m_message = creatorStashMessage(command);
if (!m_client->executeSynchronousStash(m_workingDir, m_message, errorMessage))
if (!m_client->executeSynchronousStash(m_workingDir, m_message, false, errorMessage))
m_stashResult = StashFailed;
else
m_stashResult = Stashed;