summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-05 12:30:10 -0700
committerJunio C Hamano <gitster@pobox.com>2015-10-05 12:30:10 -0700
commit5e9a74b48013a99daff50c2995ad9de80685335f (patch)
treef10be94deb7534b25d165c4dec79ab7adc89b7a9 /git-stash.sh
parent88bad58d3860a8e0cf6499951e24311d15bc63f0 (diff)
parent3086c064fbbf3c4d086f9d7c303d9aa76f5204b2 (diff)
downloadgit-5e9a74b48013a99daff50c2995ad9de80685335f.tar.gz
Merge branch 'nk/stash-show-config'
Users who are too busy to type three extra keystrokes to ask for "git stash show -p" can now set stash.showPatch configuration varible to true to always see the actual patch, not just the list of paths affected with feel for the extent of damage via diffstat. * nk/stash-show-config: stash: allow "stash show" diff output configurable
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 1d5ba7a4f9..c7c65e25f5 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -305,7 +305,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 () {