From: Junio C Hamano <gitster@pobox.com>
To: Thomas Gummerer <t.gummerer@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
sunny@sunbase.org, "Jakub Narębski" <jnareb@gmail.com>,
"Matthieu Moy" <Matthieu.Moy@grenoble-inp.fr>
Subject: Re: [PATCH v6 4/6] stash: teach 'push' (and 'create_stash') to honor pathspec
Date: Tue, 21 Feb 2017 08:55:16 -0800 [thread overview]
Message-ID: <xmqqmvdfh4az.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170219110313.24070-5-t.gummerer@gmail.com> (Thomas Gummerer's message of "Sun, 19 Feb 2017 11:03:11 +0000")
Thomas Gummerer <t.gummerer@gmail.com> writes:
> - git reset --hard ${GIT_QUIET:+-q}
This hunk is probably the most important one to review in the whole
series, in the sense that these are entirely new code that didn't
exist in the original.
> + if test $# != 0
> + then
> + saved_untracked=
> + if test -n "$(git ls-files --others -- "$@")"
I notice that "ls-files -o" used in the code before this series are
almost always used with --exclude-standard but we do not set up the
standard exclude pattern here. Is there a good reason to use (or
not to use) it here as well?
> + then
> + saved_untracked=$(
> + git ls-files -z --others -- "$@" |
> + xargs -0 git stash create -u all --)
> + fi
Running the same ls-files twice look somewhat wasteful.
I suspect that we avoid "xargs -0" in our code from portability
concern (isn't it a GNU invention?)
> + git ls-files -z -- "$@" | xargs -0 git reset ${GIT_QUIET:+-q} --
Hmm, am I being naive to suspect that the above is a roundabout way
to say:
git reset ${GIT_QUIET:+-q} -- "$@"
or is an effect quite different from that intended here?
> + git ls-files -z --modified -- "$@" | xargs -0 git checkout ${GIT_QUIET:+-q} HEAD --
Likewise. Wouldn't the above be equivalent to:
git checkout ${GIT_QUIET:+-q} HEAD -- "$@"
Or is this trying to preserve paths modified in the working tree and
fully added to the index?
> + if test -n "$(git ls-files -z --others -- "$@")"
> + then
> + git ls-files -z --others -- "$@" | xargs -0 git clean --force -d ${GIT_QUIET:+-q} --
Likewise. "ls-files --others" being the major part of what "clean"
is about, I suspect the "ls-files piped to clean" is redundant. Do
you even need a test? IOW, doesn't "git clean" with a pathspec that
does not match anything silently succeed without doing anything
harmful?
> + fi
> + if test -n "$saved_untracked"
> + then
> + git stash pop -q $saved_untracked
I see this thing was "created", and the whole point of "create" is
to be different from "save/push" that automatically adds the result
to the stash reflog. Should we be "pop"ing it, or did you mean to
just call apply_stash on it?
> + fi
> + else
> + git reset --hard ${GIT_QUIET:+-q}
> + fi
next prev parent reply other threads:[~2017-02-21 16:55 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailto:20170205202642.14216-1-t.gummerer@gmail.com>
2017-02-12 21:54 ` [PATCH v4 0/7] stash: support pathspec argument Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 1/7] Documentation/stash: remove mention of git reset --hard Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 2/7] stash: introduce push verb Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 3/7] stash: add test for the create command line arguments Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 4/7] stash: introduce new format create Thomas Gummerer
[not found] ` <vpqefz0ohub.fsf@anie.imag.fr>
2017-02-14 21:40 ` Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 5/7] stash: teach 'push' (and 'create') to honor pathspec Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 6/7] stash: use stash_push for no verb form Thomas Gummerer
2017-02-12 21:54 ` [PATCH v4 7/7] stash: allow pathspecs in the " Thomas Gummerer
2017-02-12 22:07 ` [PATCH v4 0/7] stash: support pathspec argument Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 0/6] " Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 1/6] stash: introduce push verb Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 2/6] stash: add test for the create command line arguments Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 3/6] stash: refactor stash_create Thomas Gummerer
2017-02-17 23:48 ` Jeff King
2017-02-19 9:17 ` Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 4/6] stash: teach 'push' (and 'create_stash') to honor pathspec Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 5/6] stash: use stash_push for no verb form Thomas Gummerer
2017-02-17 22:41 ` [PATCH v5 6/6] stash: allow pathspecs in the " Thomas Gummerer
2017-02-17 23:46 ` Jeff King
2017-02-19 9:18 ` Thomas Gummerer
2017-02-17 23:01 ` [PATCH v5 0/6] stash: support pathspec argument Junio C Hamano
2017-02-17 23:12 ` Thomas Gummerer
2017-02-17 23:14 ` Junio C Hamano
[not found] ` <xmqqr32wph97.fsf@gitster.mtv.corp.google.com>
2017-02-17 23:06 ` Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 " Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 1/6] stash: introduce push verb Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 2/6] stash: add test for the create command line arguments Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 3/6] stash: refactor stash_create Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 4/6] stash: teach 'push' (and 'create_stash') to honor pathspec Thomas Gummerer
2017-02-21 16:55 ` Junio C Hamano [this message]
2017-02-25 20:27 ` Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 5/6] stash: use stash_push for no verb form Thomas Gummerer
2017-02-19 11:03 ` [PATCH v6 6/6] stash: allow pathspecs in the " Thomas Gummerer
2017-02-20 7:57 ` [PATCH v6 0/6] stash: support pathspec argument Jeff King
2017-02-20 8:22 ` Junio C Hamano
2017-02-20 19:39 ` Junio C Hamano
2017-02-25 15:57 ` Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 " Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 1/6] stash: introduce push verb Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 2/6] stash: add test for the create command line arguments Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 3/6] stash: refactor stash_create Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 4/6] stash: teach 'push' (and 'create_stash') to honor pathspec Thomas Gummerer
2017-02-27 20:32 ` Junio C Hamano
2017-02-27 20:35 ` Junio C Hamano
2017-02-27 21:56 ` Thomas Gummerer
2017-02-27 22:58 ` Junio C Hamano
2017-02-27 21:09 ` Junio C Hamano
2017-02-27 21:53 ` Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 5/6] stash: use stash_push for no verb form Thomas Gummerer
2017-02-25 21:33 ` [PATCH v7 6/6] stash: allow pathspecs in the " Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 0/6] stash: support pathspec argument Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 1/6] stash: introduce push verb Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 2/6] stash: add test for the create command line arguments Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 3/6] stash: refactor stash_create Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 4/6] stash: teach 'push' (and 'create_stash') to honor pathspec Thomas Gummerer
2017-02-28 22:15 ` Junio C Hamano
2017-03-01 21:57 ` Thomas Gummerer
2017-03-01 22:43 ` Junio C Hamano
2017-02-28 20:33 ` [PATCH v8 5/6] stash: use stash_push for no verb form Thomas Gummerer
2017-02-28 20:33 ` [PATCH v8 6/6] stash: allow pathspecs in the " Thomas Gummerer
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=xmqqmvdfh4az.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=peff@peff.net \
--cc=sunny@sunbase.org \
--cc=t.gummerer@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.