Skip to content

Commit

Permalink
git-stash: do not get fooled with "color.diff = true"
Browse files Browse the repository at this point in the history
When colors are set to "true" on the repository, the git log output
will contain control characters to set/reset the colors, even when
the output is to a pipe. This makes list_stash() fail as the
downstream sed does not see what it is expecting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Pascal Obry authored and Junio C Hamano committed Nov 28, 2007
1 parent ecf4831 commit aa4f31d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
}

Expand Down

0 comments on commit aa4f31d

Please sign in to comment.