{"thread":{"id":"10346","subject":"[QGIT4 PATCH] Add --no-color option to several calls to git","startedAt":"2007-10-17T17:54:09Z","lastAt":"2007-10-18T13:41:06Z","messageCount":3,"participants":["Yaacov Akiba Slama","Marco Costalba"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"56269","messageId":"1192643649-18908-1-git-send-email-ya@slamail.org","threadId":"10346","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:54:09Z","receivedAt":"2007-10-17T17:54:09Z","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"},{"id":"56310","messageId":"e5bfff550710171638l26d3e55ej9dc8b38f8aee7592@mail.gmail.com","threadId":"10346","inReplyTo":"1192643649-18908-1-git-send-email-ya@slamail.org","subject":"Re: [QGIT4 PATCH] Add --no-color option to several calls to git","fromName":"Marco Costalba","fromEmail":"mcostalba@gmail.com","sentAt":"2007-10-17T23:38:29Z","receivedAt":"2007-10-17T23:38:29Z","isPatch":true,"sender":{"key":"mcostalba@gmail.com","avatar":null},"body":"On 10/17/07, Yaacov Akiba Slama <ya@slamail.org> wrote:\n> Setting \"diff.color = true\" in the configuration makes\n> the output of several git commands use color codes.\n> The color codes aren't parsed by qgit, so adds the --no-color\" option\n> to the calls of these git commmands.\n>\n> Signed-off-by: Yaacov Akiba Slama <ya@slamail.org>\n> ---\n\nThanks for the patch I will apply probably this week-end.\n\nProbably a point release both for qgit-2.0 and qgit-1.5.7 will be\nneeded. This is a new feature of git that could break current qgit.\n\nCould you please confirm me that with this patch qgit works flawless\nfor you when \"diff.color = true\", I' m worried to push a new point\nrelease just to discover we need to fix some more.\n\nThanks\nMarco\n"},{"id":"56398","messageId":"47176272.40704@slamail.org","threadId":"10346","inReplyTo":"e5bfff550710171638l26d3e55ej9dc8b38f8aee7592@mail.gmail.com","subject":"Re: [QGIT4 PATCH] Add --no-color option to several calls to git","fromName":"Yaacov Akiba Slama","fromEmail":"ya@slamail.org","sentAt":"2007-10-18T13:41:06Z","receivedAt":"2007-10-18T13:41:06Z","isPatch":true,"sender":{"key":"ya@slamail.org","avatar":null},"body":"Marco Costalba wrote:\n\n> Could you please confirm me that with this patch qgit works flawless\n> for you when \"diff.color = true\", I' m worried to push a new point\n> release just to discover we need to fix some more.\n>   \nI can  confirm that at least the basic operations are working for me \nwith several repositories.\nBut I wonder if it's not better to add to git the support of a \nGIT_COLORS environment variable which would be set for instance to :\n\ndiff=false:branch=false:status=false\n\nin gitk, qgit and other frontends.\n\n--yas\n"}]}