* [QGIT4 PATCH] Add --no-color option to several calls to git
@ 2007-10-17 17:44 Yaacov Akiba Slama
0 siblings, 0 replies; 4+ messages in thread
From: Yaacov Akiba Slama @ 2007-10-17 17:44 UTC (permalink / raw)
To: Git Mailing List; +Cc: Marco Costalba, Yaacov Akiba Slama
Setting "diff.color = true" in the configuration makes
the output of several git commands use color codes.
The color codes aren't parsed by qgit, so adds the --no-color" option
to the calls of these git commmands.
Signed-off-by: Yaacov Akiba Slama <ya@slamail.org>
---
src/git.cpp | 18 +++++++++---------
src/git_startup.cpp | 6 +++---
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/git.cpp b/src/git.cpp
index 6cb9c7d..ef7d736 100644
--- a/src/git.cpp
+++ b/src/git.cpp
@@ -776,18 +776,18 @@ MyProcess* Git::getDiff(SCRef sha, QObject* receiver, SCRef diffToSha, bool comb
QString runCmd;
if (sha != ZERO_SHA) {
- runCmd = "git diff-tree -r --patch-with-stat ";
+ runCmd = "git diff-tree --no-color -r --patch-with-stat ";
runCmd.append(combined ? "-c " : "-C -m "); // TODO rename for combined
runCmd.append(diffToSha + " " + sha); // diffToSha could be empty
} else
- runCmd = "git diff-index -r -m --patch-with-stat HEAD";
+ runCmd = "git diff-index --no-color -r -m --patch-with-stat HEAD";
return runAsync(runCmd, receiver);
}
const QString Git::getWorkDirDiff(SCRef fileName) {
- QString runCmd("git diff-index -r -z -m -p --full-index --no-commit-id HEAD"), runOutput;
+ QString runCmd("git diff-index --no-color -r -z -m -p --full-index --no-commit-id HEAD"), runOutput;
if (!fileName.isEmpty())
runCmd.append(" -- " + quote(fileName));
@@ -998,7 +998,7 @@ bool Git::isSameFiles(SCRef tree1Sha, SCRef tree2Sha) {
if (isParentOf(tree2Sha, tree1Sha))
return !isTreeModified(tree1Sha);
- const QString runCmd("git diff-tree -r " + tree1Sha + " " + tree2Sha);
+ const QString runCmd("git diff-tree --no-color -r " + tree1Sha + " " + tree2Sha);
QString runOutput;
if (!run(runCmd, &runOutput))
return false;
@@ -1209,7 +1209,7 @@ const RevFile* Git::getAllMergeFiles(const Rev* r) {
if (revsFiles.contains(mySha))
return revsFiles[mySha];
- QString runCmd("git diff-tree -r -m -C " + r->sha()), runOutput;
+ QString runCmd("git diff-tree --no-color -r -m -C " + r->sha()), runOutput;
if (!run(runCmd, &runOutput))
return NULL;
@@ -1230,7 +1230,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa
if (!diffToSha.isEmpty() && (sha != ZERO_SHA)) {
- QString runCmd("git diff-tree -r -m -C ");
+ QString runCmd("git diff-tree --no-color -r -m -C ");
runCmd.append(diffToSha + " " + sha);
if (!path.isEmpty())
runCmd.append(" " + path);
@@ -1250,7 +1250,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa
dbs("ASSERT in Git::getFiles, ZERO_SHA not found");
return NULL;
}
- QString runCmd("git diff-tree -r -c -C " + sha), runOutput;
+ QString runCmd("git diff-tree --no-color -r -c -C " + sha), runOutput;
if (!run(runCmd, &runOutput))
return NULL;
@@ -1337,7 +1337,7 @@ bool Git::getPatchFilter(SCRef exp, bool isRegExp, ShaSet& shaSet) {
if (buf.isEmpty())
return true;
- QString runCmd("git diff-tree -r -s --stdin "), runOutput;
+ QString runCmd("git diff-tree --no-color -r -s --stdin "), runOutput;
if (isRegExp)
runCmd.append("--pickaxe-regex ");
@@ -1386,7 +1386,7 @@ bool Git::formatPatch(SCList shaList, SCRef dirPath, SCRef remoteDir) {
QSettings settings;
const QString FPArgs(settings.value(PATCH_ARGS_KEY).toString());
- QString runCmd("git format-patch");
+ QString runCmd("git format-patch --no-color");
if (testFlag(NUMBERS_F) && !remote)
runCmd.append(" -n");
diff --git a/src/git_startup.cpp b/src/git_startup.cpp
index 95a9474..a281173 100644
--- a/src/git_startup.cpp
+++ b/src/git_startup.cpp
@@ -480,7 +480,7 @@ bool Git::startParseProc(SCList initCmd, FileHistory* fh, SCRef buf) {
bool Git::startRevList(SCList args, FileHistory* fh) {
- const QString baseCmd("git log --log-size --parents --boundary --pretty=raw -z");
+ const QString baseCmd("git log --no-color --log-size --parents --boundary --pretty=raw -z");
QStringList initCmd(baseCmd.split(' '));
if (!isMainHistory(fh))
/*
@@ -505,7 +505,7 @@ bool Git::startUnappliedList() {
// WARNING: with this command 'git log' could send spurious
// revs so we need some filter out logic during loading
- QStringList cmd(QString("git log --parents --pretty=raw -z ^HEAD").split(' '));
+ QStringList cmd(QString("git log --no-color --parents --pretty=raw -z ^HEAD").split(' '));
cmd << unAppliedShaList;
return startParseProc(cmd, revData, QString());
}
@@ -835,7 +835,7 @@ void Git::loadFileNames() {
}
if (!diffTreeBuf.isEmpty()) {
filesLoadingPending = filesLoadingCurSha = "";
- const QString runCmd("git diff-tree -r -C --stdin");
+ const QString runCmd("git diff-tree --no-color -r -C --stdin");
runAsync(runCmd, this, diffTreeBuf);
}
indexTree();
--
1.5.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [QGIT4 PATCH] Add --no-color option to several calls to git
@ 2007-10-17 17:54 Yaacov Akiba Slama
2007-10-17 23:38 ` Marco Costalba
0 siblings, 1 reply; 4+ messages in thread
From: Yaacov Akiba Slama @ 2007-10-17 17:54 UTC (permalink / raw)
To: git; +Cc: Marco Costalba, Yaacov Akiba Slama
Setting "diff.color = true" in the configuration makes
the output of several git commands use color codes.
The color codes aren't parsed by qgit, so adds the --no-color" option
to the calls of these git commmands.
Signed-off-by: Yaacov Akiba Slama <ya@slamail.org>
---
src/git.cpp | 18 +++++++++---------
src/git_startup.cpp | 6 +++---
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/git.cpp b/src/git.cpp
index 6cb9c7d..ef7d736 100644
--- a/src/git.cpp
+++ b/src/git.cpp
@@ -776,18 +776,18 @@ MyProcess* Git::getDiff(SCRef sha, QObject* receiver, SCRef diffToSha, bool comb
QString runCmd;
if (sha != ZERO_SHA) {
- runCmd = "git diff-tree -r --patch-with-stat ";
+ runCmd = "git diff-tree --no-color -r --patch-with-stat ";
runCmd.append(combined ? "-c " : "-C -m "); // TODO rename for combined
runCmd.append(diffToSha + " " + sha); // diffToSha could be empty
} else
- runCmd = "git diff-index -r -m --patch-with-stat HEAD";
+ runCmd = "git diff-index --no-color -r -m --patch-with-stat HEAD";
return runAsync(runCmd, receiver);
}
const QString Git::getWorkDirDiff(SCRef fileName) {
- QString runCmd("git diff-index -r -z -m -p --full-index --no-commit-id HEAD"), runOutput;
+ QString runCmd("git diff-index --no-color -r -z -m -p --full-index --no-commit-id HEAD"), runOutput;
if (!fileName.isEmpty())
runCmd.append(" -- " + quote(fileName));
@@ -998,7 +998,7 @@ bool Git::isSameFiles(SCRef tree1Sha, SCRef tree2Sha) {
if (isParentOf(tree2Sha, tree1Sha))
return !isTreeModified(tree1Sha);
- const QString runCmd("git diff-tree -r " + tree1Sha + " " + tree2Sha);
+ const QString runCmd("git diff-tree --no-color -r " + tree1Sha + " " + tree2Sha);
QString runOutput;
if (!run(runCmd, &runOutput))
return false;
@@ -1209,7 +1209,7 @@ const RevFile* Git::getAllMergeFiles(const Rev* r) {
if (revsFiles.contains(mySha))
return revsFiles[mySha];
- QString runCmd("git diff-tree -r -m -C " + r->sha()), runOutput;
+ QString runCmd("git diff-tree --no-color -r -m -C " + r->sha()), runOutput;
if (!run(runCmd, &runOutput))
return NULL;
@@ -1230,7 +1230,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa
if (!diffToSha.isEmpty() && (sha != ZERO_SHA)) {
- QString runCmd("git diff-tree -r -m -C ");
+ QString runCmd("git diff-tree --no-color -r -m -C ");
runCmd.append(diffToSha + " " + sha);
if (!path.isEmpty())
runCmd.append(" " + path);
@@ -1250,7 +1250,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa
dbs("ASSERT in Git::getFiles, ZERO_SHA not found");
return NULL;
}
- QString runCmd("git diff-tree -r -c -C " + sha), runOutput;
+ QString runCmd("git diff-tree --no-color -r -c -C " + sha), runOutput;
if (!run(runCmd, &runOutput))
return NULL;
@@ -1337,7 +1337,7 @@ bool Git::getPatchFilter(SCRef exp, bool isRegExp, ShaSet& shaSet) {
if (buf.isEmpty())
return true;
- QString runCmd("git diff-tree -r -s --stdin "), runOutput;
+ QString runCmd("git diff-tree --no-color -r -s --stdin "), runOutput;
if (isRegExp)
runCmd.append("--pickaxe-regex ");
@@ -1386,7 +1386,7 @@ bool Git::formatPatch(SCList shaList, SCRef dirPath, SCRef remoteDir) {
QSettings settings;
const QString FPArgs(settings.value(PATCH_ARGS_KEY).toString());
- QString runCmd("git format-patch");
+ QString runCmd("git format-patch --no-color");
if (testFlag(NUMBERS_F) && !remote)
runCmd.append(" -n");
diff --git a/src/git_startup.cpp b/src/git_startup.cpp
index 95a9474..a281173 100644
--- a/src/git_startup.cpp
+++ b/src/git_startup.cpp
@@ -480,7 +480,7 @@ bool Git::startParseProc(SCList initCmd, FileHistory* fh, SCRef buf) {
bool Git::startRevList(SCList args, FileHistory* fh) {
- const QString baseCmd("git log --log-size --parents --boundary --pretty=raw -z");
+ const QString baseCmd("git log --no-color --log-size --parents --boundary --pretty=raw -z");
QStringList initCmd(baseCmd.split(' '));
if (!isMainHistory(fh))
/*
@@ -505,7 +505,7 @@ bool Git::startUnappliedList() {
// WARNING: with this command 'git log' could send spurious
// revs so we need some filter out logic during loading
- QStringList cmd(QString("git log --parents --pretty=raw -z ^HEAD").split(' '));
+ QStringList cmd(QString("git log --no-color --parents --pretty=raw -z ^HEAD").split(' '));
cmd << unAppliedShaList;
return startParseProc(cmd, revData, QString());
}
@@ -835,7 +835,7 @@ void Git::loadFileNames() {
}
if (!diffTreeBuf.isEmpty()) {
filesLoadingPending = filesLoadingCurSha = "";
- const QString runCmd("git diff-tree -r -C --stdin");
+ const QString runCmd("git diff-tree --no-color -r -C --stdin");
runAsync(runCmd, this, diffTreeBuf);
}
indexTree();
--
1.5.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [QGIT4 PATCH] Add --no-color option to several calls to git
2007-10-17 17:54 Yaacov Akiba Slama
@ 2007-10-17 23:38 ` Marco Costalba
2007-10-18 13:41 ` Yaacov Akiba Slama
0 siblings, 1 reply; 4+ messages in thread
From: Marco Costalba @ 2007-10-17 23:38 UTC (permalink / raw)
To: Yaacov Akiba Slama; +Cc: git
On 10/17/07, Yaacov Akiba Slama <ya@slamail.org> wrote:
> Setting "diff.color = true" in the configuration makes
> the output of several git commands use color codes.
> The color codes aren't parsed by qgit, so adds the --no-color" option
> to the calls of these git commmands.
>
> Signed-off-by: Yaacov Akiba Slama <ya@slamail.org>
> ---
Thanks for the patch I will apply probably this week-end.
Probably a point release both for qgit-2.0 and qgit-1.5.7 will be
needed. This is a new feature of git that could break current qgit.
Could you please confirm me that with this patch qgit works flawless
for you when "diff.color = true", I' m worried to push a new point
release just to discover we need to fix some more.
Thanks
Marco
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [QGIT4 PATCH] Add --no-color option to several calls to git
2007-10-17 23:38 ` Marco Costalba
@ 2007-10-18 13:41 ` Yaacov Akiba Slama
0 siblings, 0 replies; 4+ messages in thread
From: Yaacov Akiba Slama @ 2007-10-18 13:41 UTC (permalink / raw)
To: Marco Costalba; +Cc: git
Marco Costalba wrote:
> Could you please confirm me that with this patch qgit works flawless
> for you when "diff.color = true", I' m worried to push a new point
> release just to discover we need to fix some more.
>
I can confirm that at least the basic operations are working for me
with several repositories.
But I wonder if it's not better to add to git the support of a
GIT_COLORS environment variable which would be set for instance to :
diff=false:branch=false:status=false
in gitk, qgit and other frontends.
--yas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-18 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-17 17:44 [QGIT4 PATCH] Add --no-color option to several calls to git Yaacov Akiba Slama
-- strict thread matches above, loose matches on Subject: below --
2007-10-17 17:54 Yaacov Akiba Slama
2007-10-17 23:38 ` Marco Costalba
2007-10-18 13:41 ` Yaacov Akiba Slama
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).