All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pascal Obry <pascal.obry@wanadoo.fr>
To: git list <git@vger.kernel.org>
Subject: [PATCH] Use --no-color option on git log commands.
Date: Mon, 26 Nov 2007 23:04:28 +0100	[thread overview]
Message-ID: <474B42EC.1000408@wanadoo.fr> (raw)


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

             reply	other threads:[~2007-11-26 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 22:04 Pascal Obry [this message]
2007-11-26 22:30 ` [PATCH] Use --no-color option on git log commands 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

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

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

  git send-email \
    --in-reply-to=474B42EC.1000408@wanadoo.fr \
    --to=pascal.obry@wanadoo.fr \
    --cc=git@vger.kernel.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.