git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Yaacov Akiba Slama <ya@slamail.org>
To: git@vger.kernel.org
Cc: Marco Costalba <mcostalba@gmail.com>,
	Yaacov Akiba Slama <ya@slamail.org>
Subject: [QGIT4 PATCH] Add --no-color option to several calls to git
Date: Wed, 17 Oct 2007 19:54:09 +0200	[thread overview]
Message-ID: <1192643649-18908-1-git-send-email-ya@slamail.org> (raw)

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

             reply	other threads:[~2007-10-17 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17 17:54 Yaacov Akiba Slama [this message]
2007-10-17 23:38 ` [QGIT4 PATCH] Add --no-color option to several calls to git Marco Costalba
2007-10-18 13:41   ` Yaacov Akiba Slama
  -- strict thread matches above, loose matches on Subject: below --
2007-10-17 17:44 Yaacov Akiba Slama

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1192643649-18908-1-git-send-email-ya@slamail.org \
    --to=ya@slamail.org \
    --cc=git@vger.kernel.org \
    --cc=mcostalba@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).