{"thread":{"id":"10347","subject":"[QGIT4 PATCH] Add --no-color option to several calls to git","startedAt":"2007-10-17T17:44:51Z","lastAt":"2007-10-17T17:44:51Z","messageCount":1,"participants":["Yaacov Akiba Slama"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"56273","messageId":"1192643091-17674-1-git-send-email-ya@slamail.org","threadId":"10347","inReplyTo":null,"subject":"[QGIT4 PATCH] Add --no-color option to several calls to git","fromName":"Yaacov Akiba Slama","fromEmail":"ya@slamail.org","sentAt":"2007-10-17T17:44:51Z","receivedAt":"2007-10-17T17:44:51Z","isPatch":true,"sender":{"key":"ya@slamail.org","avatar":null},"body":"Setting \"diff.color = true\" in the configuration makes\nthe output of several git commands use color codes.\nThe color codes aren't parsed by qgit, so adds the --no-color\" option\nto the calls of these git commmands.\n\nSigned-off-by: Yaacov Akiba Slama <ya@slamail.org>\n---\n src/git.cpp         |   18 +++++++++---------\n src/git_startup.cpp |    6 +++---\n 2 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/src/git.cpp b/src/git.cpp\nindex 6cb9c7d..ef7d736 100644\n--- a/src/git.cpp\n+++ b/src/git.cpp\n@@ -776,18 +776,18 @@ MyProcess* Git::getDiff(SCRef sha, QObject* receiver, SCRef diffToSha, bool comb\n \n \tQString runCmd;\n \tif (sha != ZERO_SHA) {\n-\t\trunCmd = \"git diff-tree -r --patch-with-stat \";\n+\t\trunCmd = \"git diff-tree --no-color -r --patch-with-stat \";\n \t\trunCmd.append(combined ? \"-c \" : \"-C -m \"); // TODO rename for combined\n \t\trunCmd.append(diffToSha + \" \" + sha); // diffToSha could be empty\n \t} else\n-\t\trunCmd = \"git diff-index -r -m --patch-with-stat HEAD\";\n+\t\trunCmd = \"git diff-index --no-color -r -m --patch-with-stat HEAD\";\n \n \treturn runAsync(runCmd, receiver);\n }\n \n const QString Git::getWorkDirDiff(SCRef fileName) {\n \n-\tQString runCmd(\"git diff-index -r -z -m -p --full-index --no-commit-id HEAD\"), runOutput;\n+\tQString runCmd(\"git diff-index --no-color -r -z -m -p --full-index --no-commit-id HEAD\"), runOutput;\n \tif (!fileName.isEmpty())\n \t\trunCmd.append(\" -- \" + quote(fileName));\n \n@@ -998,7 +998,7 @@ bool Git::isSameFiles(SCRef tree1Sha, SCRef tree2Sha) {\n \tif (isParentOf(tree2Sha, tree1Sha))\n \t\treturn !isTreeModified(tree1Sha);\n \n-\tconst QString runCmd(\"git diff-tree -r \" + tree1Sha + \" \" + tree2Sha);\n+\tconst QString runCmd(\"git diff-tree --no-color -r \" + tree1Sha + \" \" + tree2Sha);\n \tQString runOutput;\n \tif (!run(runCmd, &runOutput))\n \t\treturn false;\n@@ -1209,7 +1209,7 @@ const RevFile* Git::getAllMergeFiles(const Rev* r) {\n \tif (revsFiles.contains(mySha))\n \t\treturn revsFiles[mySha];\n \n-\tQString runCmd(\"git diff-tree -r -m -C \" + r->sha()), runOutput;\n+\tQString runCmd(\"git diff-tree --no-color -r -m -C \" + r->sha()), runOutput;\n \tif (!run(runCmd, &runOutput))\n \t\treturn NULL;\n \n@@ -1230,7 +1230,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa\n \n \tif (!diffToSha.isEmpty() && (sha != ZERO_SHA)) {\n \n-\t\tQString runCmd(\"git diff-tree -r -m -C \");\n+\t\tQString runCmd(\"git diff-tree --no-color -r -m -C \");\n \t\trunCmd.append(diffToSha + \" \" + sha);\n \t\tif (!path.isEmpty())\n \t\t\trunCmd.append(\" \" + path);\n@@ -1250,7 +1250,7 @@ const RevFile* Git::getFiles(SCRef sha, SCRef diffToSha, bool allFiles, SCRef pa\n \t\tdbs(\"ASSERT in Git::getFiles, ZERO_SHA not found\");\n \t\treturn NULL;\n \t}\n-\tQString runCmd(\"git diff-tree -r -c -C \" + sha), runOutput;\n+\tQString runCmd(\"git diff-tree --no-color -r -c -C \" + sha), runOutput;\n \tif (!run(runCmd, &runOutput))\n \t\treturn NULL;\n \n@@ -1337,7 +1337,7 @@ bool Git::getPatchFilter(SCRef exp, bool isRegExp, ShaSet& shaSet) {\n \tif (buf.isEmpty())\n \t\treturn true;\n \n-\tQString runCmd(\"git diff-tree -r -s --stdin \"), runOutput;\n+\tQString runCmd(\"git diff-tree --no-color -r -s --stdin \"), runOutput;\n \tif (isRegExp)\n \t\trunCmd.append(\"--pickaxe-regex \");\n \n@@ -1386,7 +1386,7 @@ bool Git::formatPatch(SCList shaList, SCRef dirPath, SCRef remoteDir) {\n \tQSettings settings;\n \tconst QString FPArgs(settings.value(PATCH_ARGS_KEY).toString());\n \n-\tQString runCmd(\"git format-patch\");\n+\tQString runCmd(\"git format-patch --no-color\");\n \tif (testFlag(NUMBERS_F) && !remote)\n \t\trunCmd.append(\" -n\");\n \ndiff --git a/src/git_startup.cpp b/src/git_startup.cpp\nindex 95a9474..a281173 100644\n--- a/src/git_startup.cpp\n+++ b/src/git_startup.cpp\n@@ -480,7 +480,7 @@ bool Git::startParseProc(SCList initCmd, FileHistory* fh, SCRef buf) {\n \n bool Git::startRevList(SCList args, FileHistory* fh) {\n \n-\tconst QString baseCmd(\"git log --log-size --parents --boundary --pretty=raw -z\");\n+\tconst QString baseCmd(\"git log --no-color --log-size --parents --boundary --pretty=raw -z\");\n \tQStringList initCmd(baseCmd.split(' '));\n \tif (!isMainHistory(fh))\n \t/*\n@@ -505,7 +505,7 @@ bool Git::startUnappliedList() {\n \n \t// WARNING: with this command 'git log' could send spurious\n \t// revs so we need some filter out logic during loading\n-\tQStringList cmd(QString(\"git log --parents --pretty=raw -z ^HEAD\").split(' '));\n+\tQStringList cmd(QString(\"git log --no-color --parents --pretty=raw -z ^HEAD\").split(' '));\n \tcmd << unAppliedShaList;\n \treturn startParseProc(cmd, revData, QString());\n }\n@@ -835,7 +835,7 @@ void Git::loadFileNames() {\n \t}\n \tif (!diffTreeBuf.isEmpty()) {\n \t\tfilesLoadingPending = filesLoadingCurSha = \"\";\n-\t\tconst QString runCmd(\"git diff-tree -r -C --stdin\");\n+\t\tconst QString runCmd(\"git diff-tree --no-color -r -C --stdin\");\n \t\trunAsync(runCmd, this, diffTreeBuf);\n \t}\n \tindexTree();\n-- \n1.5.3.4\n"}]}