forked from qt-creator/qt-creator
Git: Use internal log highlighter for old git versions
Git didn't have RGB color support before version 2.3.0.
If an older version is used, fall back to the internal
log highlighter, i.e. don't disable it.
Amends commit d1b096699
Change-Id: I66f84dc4e79f7374d02f6d76c6f912c43e7f04bd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
1dc00ac125
commit
79766caf52
@@ -557,6 +557,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static bool gitHasRgbColors()
|
||||
{
|
||||
const unsigned gitVersion = GitClient::instance()->gitVersion();
|
||||
return gitVersion >= 0x020300U;
|
||||
}
|
||||
|
||||
class GitLogArgumentsWidget : public BaseGitLogArgumentsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -608,8 +614,7 @@ public:
|
||||
|
||||
QStringList graphArgs = {graphOption, "--oneline", "--topo-order"};
|
||||
|
||||
const unsigned gitVersion = GitClient::instance()->gitVersion();
|
||||
if (gitVersion >= 0x020300U)
|
||||
if (gitHasRgbColors())
|
||||
graphArgs << formatArg;
|
||||
else
|
||||
graphArgs << "--pretty=format:%h %d %an %s %ci";
|
||||
@@ -1035,8 +1040,7 @@ void GitClient::status(const QString &workingDirectory) const
|
||||
|
||||
static QStringList normalLogArguments()
|
||||
{
|
||||
const unsigned gitVersion = GitClient::instance()->gitVersion();
|
||||
if (gitVersion < 0x020300U)
|
||||
if (!gitHasRgbColors())
|
||||
return {};
|
||||
|
||||
auto colorName = [](Theme::Color color) { return creatorTheme()->color(color).name(); };
|
||||
@@ -1095,7 +1099,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
if (arguments.contains(patchOption)) {
|
||||
arguments.removeAll(colorOption);
|
||||
editor->setHighlightingEnabled(true);
|
||||
} else {
|
||||
} else if (gitHasRgbColors()) {
|
||||
editor->setHighlightingEnabled(false);
|
||||
}
|
||||
if (!arguments.contains(graphOption) && !arguments.contains(patchOption))
|
||||
|
||||
Reference in New Issue
Block a user