git-stash: do not get fooled with "color.diff = true"
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>
Pascal Obry committed
Nov 26, 2007 at 23:04 UTC
aa4f31d5a3923939bf2cb670ecaa4f68025f4bf3
1 file changed
+2
-2
git-stash.sh
+2
-2
@@ -37,7 +37,7 @@ create_stash () {
37
# state of the base commit
38
if b_commit=$(git rev-parse --verify HEAD)
39
then
40
- head=$(git log --abbrev-commit --pretty=oneline -n 1 HEAD)
40
+ head=$(git log --no-color --abbrev-commit --pretty=oneline -n 1 HEAD --)
41
else
42
die "You do not have the initial commit yet"
43
fi
@@ -108,7 +108,7 @@ have_stash () {
108
109
list_stash () {
110
have_stash || return 0
111
- git log --pretty=oneline -g "$@" $ref_stash |
111
+ git log --no-color --pretty=oneline -g "$@" $ref_stash -- |
112
sed -n -e 's/^[.0-9a-f]* refs\///p'
113
}
114