git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use --no-color option on git log commands.

From
Pascal Obry <pascal.obry@wanadoo.fr>
Date
Nov 26, 2007, 22:04 UTC
Message-ID
<474B42EC.1000408@wanadoo.fr>
When colors are activated on the repository the git log output
will contain control characters to set/reset the colors. This
makes list_stash() fails as the sed regular expression does not
match the color control characters. Also use --no-color when
computing the head on create_stash() procedure.
---
 git-stash.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 534eb16..cde9767 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -37,7 +37,7 @@ create_stash () {
        # state of the base commit
        if b_commit=$(git rev-parse --verify HEAD)
        then
-               head=$(git log --abbrev-commit --pretty=oneline -n 1 HEAD)
+               head=$(git log --no-color --abbrev-commit
--pretty=oneline -n 1 HEAD)
        else
                die "You do not have the initial commit yet"
        fi
@@ -108,7 +108,7 @@ have_stash () {

 list_stash () {
        have_stash || return 0
-       git log --pretty=oneline -g "$@" $ref_stash |
+       git log --no-color --pretty=oneline -g "$@" $ref_stash |
        sed -n -e 's/^[.0-9a-f]* refs\///p'
 }

--
1.5.3.6.959.g1ab5
-- 
--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
Next: Junio C Hamano
Message 1 of 10 in “Use --no-color option on git log commands.”
  1. Use --no-color option on git log commands.Pascal Obry, Nov 26, 2007
  2. Junio C HamanoNov 26, 2007
  3. Pascal ObryNov 27, 2007
  4. Junio C HamanoNov 28, 2007
  5. "color.diff = true" is not "always" anymore.Junio C Hamano, Nov 28, 2007
  6. Johannes SchindelinNov 28, 2007
  7. Jeff KingNov 28, 2007
  8. Junio C HamanoDec 1, 2007
  9. Jeff KingDec 1, 2007
  10. Junio C HamanoDec 1, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.