forked from qt-creator/qt-creator
Git: Prevent or close fixup editor if no local commits are found
Change-Id: I546241fb3531cbc542b97d6d0f53382c9225dcf4 Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
5a4cdc11cb
commit
bcd8c02aea
@@ -2521,6 +2521,16 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
|
||||
// Run status. Note that it has exitcode 1 if there are no added files.
|
||||
QString output;
|
||||
if (commitData.commitType == FixupCommit) {
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("HEAD") << QLatin1String("--not")
|
||||
<< QLatin1String("--remotes") << QLatin1String("-n1");
|
||||
synchronousLog(repoDirectory, arguments, &output, errorMessage);
|
||||
if (output.isEmpty()) {
|
||||
*errorMessage = msgNoCommits(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const StatusResult status = gitStatus(repoDirectory, ShowAll, &output, errorMessage);
|
||||
switch (status) {
|
||||
case StatusChanged:
|
||||
@@ -3066,6 +3076,11 @@ QString GitClient::msgNoChangedFiles()
|
||||
return tr("There are no modified files.");
|
||||
}
|
||||
|
||||
QString GitClient::msgNoCommits(bool includeRemote)
|
||||
{
|
||||
return includeRemote ? tr("No commits were found") : tr("No local commits were found");
|
||||
}
|
||||
|
||||
void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
|
||||
{
|
||||
QStringList arguments(QLatin1String("stash"));
|
||||
|
||||
Reference in New Issue
Block a user