Junio C Hamano <gits...@pobox.com> writes:

> Jeff King <p...@peff.net> writes:
>
>> When you list stashes, you can provide arbitrary git-log
>> options to change the display. However, adding just "-p"
>> does nothing, because each stash is actually a merge commit.
>>
>> This implementation detail is easy to forget, leading to
>> confused users who think "-p" is not working. We can make
>> this easier by specifying "--cc" as a default ourselves
>> (which does nothing if no diff format is requested by the
>> user).
>
> Sigh.
>
> "git log --cc" is one of the things I wanted for a long time to fix.
> When the user explicitly asks "--cc", we currently ignore it, but
> because we know the user wants to view combined diff, we should turn
> "-p" on automatically.  And the change this patch introduces will be
> broken when we fix "log --cc" ("stash list" will end up always
> showing the patch, without a way to disable it).
>
> Can you make this conditional?  Do this only when <options> are
> given to "git stash list" command and that includes "-p" or
> something?

Perhaps something along this line?

 git-stash.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index ae73ba4..0db1b19 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -297,8 +297,15 @@ have_stash () {
 
 list_stash () {
        have_stash || return 0
-       git log --format="%gd: %gs" -g --cc --simplify-combined-diff \
-               "$@" $ref_stash --
+       case " $* " in
+       *' --cc '*)
+               ;; # the user knows what she is doing
+       *' -p '* | *' -U'*)
+               set x "--cc" "--simplify-combined-diff" "$@"
+               shift
+               ;;
+       esac
+       git log --format="%gd: %gs" -g "$@" $ref_stash --
 }
 
 show_stash () {
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to