From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v2 5/6] stash: default listing to "--cc --simplify-combined-diff"
Date: Wed, 30 Jul 2014 12:43:09 -0700 [thread overview]
Message-ID: <xmqqtx5yy6nm.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqppgo2dqr.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Tue, 29 Jul 2014 11:58:52 -0700")
Junio C Hamano <gitster@pobox•com> writes:
> Jeff King <peff@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 () {
next prev parent reply other threads:[~2014-07-30 19:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 11:53 [PATCH 0/2] improving "git stash list -p" Jeff King
2014-07-29 12:00 ` [PATCH 1/2] add --simplify-combined-diff option Jeff King
2014-07-29 13:00 ` Jeff King
2014-07-29 12:03 ` [PATCH 2/2] stash: default listing to "--cc --simplify-combined-diff" Jeff King
2014-07-29 12:07 ` [RFC/PATCH 3/2] stash: show combined diff with "stash show" Jeff King
2014-07-29 18:13 ` Junio C Hamano
2014-07-31 0:17 ` Jeff King
2014-07-31 0:28 ` Junio C Hamano
2014-07-29 17:53 ` [PATCH v2 0/6] improving "git stash list -p" Jeff King
2014-07-29 17:53 ` [PATCH v2 1/6] revision: drop useless string offset when parsing "--pretty" Jeff King
2014-07-29 17:54 ` [PATCH v2 2/6] pretty: treat "--format=" as an empty userformat Jeff King
2014-07-29 17:56 ` [PATCH v2 3/6] pretty: make empty userformats truly empty Jeff King
2014-07-29 17:57 ` [PATCH v2 4/6] add --simplify-combined-diff option Jeff King
2014-07-29 20:02 ` Junio C Hamano
2014-07-29 17:57 ` [PATCH v2 5/6] stash: default listing to "--cc --simplify-combined-diff" Jeff King
2014-07-29 18:58 ` Junio C Hamano
2014-07-30 19:43 ` Junio C Hamano [this message]
2014-07-31 0:09 ` Jeff King
2014-08-12 23:30 ` Keller, Jacob E
2014-07-29 17:58 ` [PATCH v2 6/6] stash: show combined diff with "stash show" Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtx5yy6nm.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox