From: Namhyung Kim <namhyung@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] stash: Add stash.showFlag config variable
Date: Fri, 28 Aug 2015 00:36:35 +0900 [thread overview]
Message-ID: <CAM9d7chUf=srU060Q4+qQ4mFBaXmRL0yQ1Ns4UeWcDj62CFoYg@mail.gmail.com> (raw)
In-Reply-To: <1440688825-1303-1-git-send-email-szeder@ira.uka.de>
Hi,
On Fri, Aug 28, 2015 at 12:20 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> Hi,
>
> I haven't made up my mind about this feature yet, but have a few
> comments about its implementation.
Thanks for taking your time!
>
>> diff --git a/git-stash.sh b/git-stash.sh
>> index 1d5ba7a..8432435 100755
>> --- a/git-stash.sh
>> +++ b/git-stash.sh
>> @@ -33,6 +33,12 @@ else
>> reset_color=
>> fi
>>
>> +if git config --get stash.showflag > /dev/null 2> /dev/null; then
>> + show_flag=$(git config --get stash.showflag)
>> +else
>> + show_flag=--stat
>> +fi
>> +
>
> Forking and executing processes are costly on some important platforms
> we care about, so we should strive to avoid them whenever possible.
>
> - This hunk runs the the exact same 'git config' command twice. Run it
> only once, perhaps something like this:
>
> show_flag=$(git config --get stash.showflag || echo --stat)
>
> (I hope there are no obscure crazy 'echo' implemtations out there
> that might barf on the unknown option '--stat'...)
What about `echo "--stat"` then?
>
> - It runs 'git config' in the main code path, i.e. even for subcommands
> other than 'show'. Run it only for 'git stash show'.
>
> - This config setting is not relevant if there were options given on the
> command line. Run it only if there are no options given, i.e. when
> $FLAGS is empty.
Fair enough. I'll resend v2.
Thanks,
Namhyung
>
>
>> no_changes () {
>> git diff-index --quiet --cached HEAD --ignore-submodules -- &&
>> git diff-files --quiet --ignore-submodules &&
>> @@ -305,7 +311,7 @@ show_stash () {
>> ALLOW_UNKNOWN_FLAGS=t
>> assert_stash_like "$@"
>>
>> - git diff ${FLAGS:---stat} $b_commit $w_commit
>> + git diff ${FLAGS:-${show_flag}} $b_commit $w_commit
>> }
>>
>> show_help () {
>> --
>> 2.5.0
next prev parent reply other threads:[~2015-08-27 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 13:52 [PATCH] stash: Add stash.showFlag config variable Namhyung Kim
2015-08-27 15:20 ` SZEDER Gábor
2015-08-27 15:36 ` Namhyung Kim [this message]
2015-08-28 0:16 ` Eric Sunshine
2015-08-28 1:47 ` Namhyung Kim
2015-08-28 1:08 ` Junio C Hamano
2015-08-28 1:54 ` Namhyung Kim
2015-08-28 18:10 ` Junio C Hamano
2015-08-29 15:19 ` Namhyung Kim
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='CAM9d7chUf=srU060Q4+qQ4mFBaXmRL0yQ1Ns4UeWcDj62CFoYg@mail.gmail.com' \
--to=namhyung@gmail.com \
--cc=git@vger.kernel.org \
--cc=szeder@ira.uka.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).