Commit b8ce2b10 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Disambiguation for files in git commands

With many git commands it is safer to disambiguate files from refs by
putting '--' in front of the list of files.

Also corrected a margin in the git submit panel.
parent 6bc0da69
......@@ -170,7 +170,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam
if (Git::Constants::debug)
qDebug() << "diff" << workingDirectory << fileNames;
QStringList arguments;
arguments << QLatin1String("diff") << fileNames;
arguments << QLatin1String("diff") << QLatin1String("--") << fileNames;
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
const QString title = tr("Git Diff");
......@@ -187,7 +187,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
QStringList arguments;
arguments << QLatin1String("diff");
if (!fileName.isEmpty())
arguments << fileName;
arguments << QLatin1String("--") << fileName;
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
const QString title = tr("Git Diff %1").arg(fileName);
......@@ -246,7 +246,7 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
if (Git::Constants::debug)
qDebug() << "blame" << workingDirectory << fileName;
QStringList arguments(QLatin1String("blame"));
arguments << fileName;
arguments << QLatin1String("--") << fileName;
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
const QString title = tr("Git Blame %1").arg(fileName);
......@@ -314,7 +314,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
QByteArray outputText;
QByteArray errorText;
QStringList arguments;
arguments << QLatin1String("reset") << QLatin1String("HEAD") << files;
arguments << QLatin1String("reset") << QLatin1String("HEAD") << QLatin1String("--") << files;
const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
const QString output = QString::fromLocal8Bit(outputText);
m_plugin->m_outputWindow->popup(false);
......@@ -643,9 +643,9 @@ GitCommand::~GitCommand()
{
}
void GitCommand::execute(const QStringList &arguments
, const QString &workingDirectory
, const ProjectExplorer::Environment &environment)
void GitCommand::execute(const QStringList &arguments,
const QString &workingDirectory,
const ProjectExplorer::Environment &environment)
{
if (Git::Constants::debug)
qDebug() << "GitCommand::execute" << workingDirectory << arguments;
......@@ -663,9 +663,9 @@ void GitCommand::execute(const QStringList &arguments
, Core::ProgressManagerInterface::CloseOnSuccess);
}
void GitCommand::run(const QStringList &arguments
, const QString &workingDirectory
, const ProjectExplorer::Environment &environment)
void GitCommand::run(const QStringList &arguments,
const QString &workingDirectory,
const ProjectExplorer::Environment &environment)
{
if (Git::Constants::debug)
qDebug() << "GitCommand::run" << workingDirectory << arguments;
......
......@@ -57,9 +57,9 @@ GitSubmitEditorPanelData GitSubmitEditorWidget::panelData() const
rc.author = m_gitSubmitPanelUi.authorLineEdit->text();
rc.email = m_gitSubmitPanelUi.emailLineEdit->text();
return rc;
};
}
void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
{
m_gitSubmitPanelUi.authorLineEdit->setText(data.author);
m_gitSubmitPanelUi.emailLineEdit->setText(data.email);
......
......@@ -11,6 +11,9 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="infoGroup">
<property name="title">
......
......@@ -240,7 +240,7 @@ bool VCSBaseSubmitEditor::restoreState(const QByteArray &/*state*/)
return true;
}
QStringList VCSBaseSubmitEditor::checkedFiles() const
QStringList VCSBaseSubmitEditor::checkedFiles() const
{
return vcsFileListToFileList(m_d->m_widget->checkedFiles());
}
......@@ -255,7 +255,7 @@ void VCSBaseSubmitEditor::addFiles(const QStringList& list, bool checked, bool u
m_d->m_widget->addFiles(list, checked, userCheckable);
}
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
{
emit diffSelectedFiles(vcsFileListToFileList(rawList));
}
......@@ -299,4 +299,4 @@ QIcon VCSBaseSubmitEditor::submitIcon()
return QIcon(QLatin1String(":/vcsbase/images/submit.png"));
}
}
} // namespace VCSBase
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