git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use --no-color option on git log commands.
@ 2007-11-26 22:04 Pascal Obry
  2007-11-26 22:30 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Pascal Obry @ 2007-11-26 22:04 UTC (permalink / raw)
  To: git list


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-12-01  6:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-26 22:04 [PATCH] Use --no-color option on git log commands Pascal Obry
2007-11-26 22:30 ` Junio C Hamano
2007-11-27 18:24   ` Pascal Obry
2007-11-28  4:45     ` Junio C Hamano
2007-11-28  7:26   ` [PATCH/RFC] "color.diff = true" is not "always" anymore Junio C Hamano
2007-11-28 13:13     ` Johannes Schindelin
2007-11-28 19:04     ` Jeff King
2007-12-01  2:36       ` Junio C Hamano
2007-12-01  4:15         ` Jeff King
2007-12-01  6:10           ` Junio C Hamano

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 NNTP newsgroup(s).