git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] stash show: use default pretty format

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Jan 12, 2012, 07:05 UTC
Message-ID
<1326351953-3724-1-git-send-email-rctay89@gmail.com>

By default (ie. when stash show is invoked without any arguments), the diff stat of the stashed changes is displayed. Let git-diff decide the default pretty format to use.

This gives git more consistency, as users who have set their pretty.format config would naturally expect `git-stash show` to display the diff in the same pretty format as the other diff-producing procelain like git-log and git-show.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
 git-stash.sh     |    2 +-
 t/t3903-stash.sh |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index fe4ab28..a0db3de 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -271,7 +271,7 @@ list_stash () {
 show_stash () {
 	assert_stash_like "$@"
 
-	git diff ${FLAGS:---stat} $b_commit $w_commit
+	git diff ${FLAGS} $b_commit $w_commit
 }
 
 #
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index dbe2ac1..7a18af8 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -446,7 +446,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '
 	 file |    1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
-	git stash show ${STASH_ID} >actual &&
+	git stash show --stat ${STASH_ID} >actual &&
 	test_cmp expected actual
 '
 
@@ -484,7 +484,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '
 	 file |    1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
-	git stash show ${STASH_ID} >actual &&
+	git stash show --stat ${STASH_ID} >actual &&
 	test_cmp expected actual
 '
 
-- 
1.7.9.rc0.132.ge406
Next: Junio C Hamano
Message 1 of 2 in “stash show: use default pretty format”
  1. stash show: use default pretty formatTay Ray Chuan, Jan 12, 2012
  2. Junio C HamanoJan 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.