aboutsummaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2015-08-30 00:25:57 +0900
committerJunio C Hamano <gitster@pobox.com>2015-08-31 11:29:04 -0700
commit3086c064fbbf3c4d086f9d7c303d9aa76f5204b2 (patch)
tree7085dbdb7bc5ecf97a95fec0cda2f808940dbf24 /git-stash.sh
parenta17c56c056d5fea0843b429132904c429a900229 (diff)
downloadgit-3086c064fbbf3c4d086f9d7c303d9aa76f5204b2.tar.gz
git-3086c064fbbf3c4d086f9d7c303d9aa76f5204b2.tar.xz
stash: allow "stash show" diff output configurable
Some users might want to see diff (patch) output always rather than diffstat when [s]he runs 'git stash show'. Although this can be done with adding -p option, users are too lazy to type extra three keys. Add two variables that control to show diffstat and patch output respectively. The stash.showStat is for diffstat and default is true. The stat.showPatch is for the patch output and default is false. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 8e9e2cd7d..92bc0e1ad 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -307,7 +307,25 @@ show_stash () {
ALLOW_UNKNOWN_FLAGS=t
assert_stash_like "$@"
- git diff ${FLAGS:---stat} $b_commit $w_commit
+ if test -z "$FLAGS"
+ then
+ if test "$(git config --bool stash.showStat || echo true)" = "true"
+ then
+ FLAGS=--stat
+ fi
+
+ if test "$(git config --bool stash.showPatch || echo false)" = "true"
+ then
+ FLAGS=${FLAGS}${FLAGS:+ }-p
+ fi
+
+ if test -z "$FLAGS"
+ then
+ return 0
+ fi
+ fi
+
+ git diff ${FLAGS} $b_commit $w_commit
}
show_help () {