aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2020-05-19 08:24:36 +0200
committerAndré Hartmann <aha_1980@gmx.de>2020-05-19 12:00:52 +0000
commit79766caf526e4b0b99b5cde4e8923eac71ed3d9b (patch)
tree3cfe8a5772cc02bef7a5707f92f39687b3d73f5b /src/plugins/git
parent1dc00ac12546375a9cdb374548b8c3546d11eefd (diff)
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>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/gitclient.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 1854c359e1..ed5b4f8745 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -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))