From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jakub Narębski" <jnareb@gmail.com>, "Jeff King" <peff@peff.net>
Subject: [PATCH v2 0/1] Support `git reset --stdin`
Date: Fri, 27 Jan 2017 13:38:50 +0100 (CET) [thread overview]
Message-ID: <cover.1485520718.git.johannes.schindelin@gmx.de> (raw)
In-Reply-To: <cover.1476202100.git.johannes.schindelin@gmx.de>
This feature was missing, and made it cumbersome for third-party
tools to reset a lot of paths in one go.
Support for --stdin has been added, following builtin/checkout-index.c's
example.
Changes since v1:
- adjusted commit message to explain why we read everything before
resetting
- fixed synopsis (`--stdin` does not work with `-- <path>...`)
- avoid handling patch_mode twice
- use PATHSPEC_LITERAL_PATH to avoid interpreting input as wildcards
Johannes Schindelin (1):
reset: support the --stdin option
Documentation/git-reset.txt | 9 ++++++++
builtin/reset.c | 54 ++++++++++++++++++++++++++++++++++++++++++++-
t/t7107-reset-stdin.sh | 33 +++++++++++++++++++++++++++
3 files changed, 95 insertions(+), 1 deletion(-)
create mode 100755 t/t7107-reset-stdin.sh
base-commit: 4e59582ff70d299f5a88449891e78d15b4b3fabe
Published-As: https://github.com/dscho/git/releases/tag/reset-stdin-v2
Fetch-It-Via: git fetch https://github.com/dscho/git reset-stdin-v2
Interdiff vs v1:
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 533ef69f91..abb71bb805 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -8,8 +8,9 @@ git-reset - Reset current HEAD to the specified state
SYNOPSIS
--------
[verse]
-'git reset' [-q] [--stdin [-z]] [<tree-ish>] [--] <paths>...
+'git reset' [-q] [<tree-ish>] [--] <paths>...
'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]
+'git reset' [-q] [--stdin [-z]] [<tree-ish>]
'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
DESCRIPTION
diff --git a/builtin/reset.c b/builtin/reset.c
index 6de3936aed..1d3075b7ee 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -26,7 +26,8 @@
static const char * const git_reset_usage[] = {
N_("git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"),
- N_("git reset [-q] [--stdin [-z]] [<tree-ish>] [--] <paths>..."),
+ N_("git reset [-q] [<tree-ish>] [--] <paths>..."),
+ N_("git reset [-q] [--stdin [-z]] [<tree-ish>]"),
N_("git reset --patch [<tree-ish>] [--] [<paths>...]"),
NULL
};
@@ -317,9 +318,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (pathspec.nr)
die(_("--stdin is incompatible with path arguments"));
- if (patch_mode)
- flags |= PATHSPEC_PREFIX_ORIGIN;
-
while (getline_fn(&buf, stdin) != EOF) {
if (!nul_term_line && buf.buf[0] == '"') {
strbuf_reset(&unquoted);
@@ -336,8 +334,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
ALLOC_GROW(stdin_paths, stdin_nr + 1, stdin_alloc);
stdin_paths[stdin_nr++] = NULL;
+ flags |= PATHSPEC_LITERAL_PATH;
parse_pathspec(&pathspec, 0, flags, prefix,
(const char **)stdin_paths);
+
} else if (nul_term_line)
die(_("-z requires --stdin"));
--
2.11.1.windows.prerelease.2.9.g3014b57
next prev parent reply other threads:[~2017-01-27 12:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-11 16:08 [PATCH 0/2] Support `git reset --stdin` Johannes Schindelin
2016-10-11 16:09 ` [PATCH 1/2] reset: fix usage Johannes Schindelin
2016-10-11 16:09 ` [PATCH 2/2] reset: support the --stdin option Johannes Schindelin
2016-10-11 17:53 ` Junio C Hamano
2016-10-12 12:57 ` Johannes Schindelin
2016-10-11 20:49 ` Jakub Narębski
2016-10-12 12:39 ` Johannes Schindelin
2016-10-11 18:34 ` [PATCH 0/2] Support `git reset --stdin` Jeff King
2016-10-11 19:27 ` Junio C Hamano
2016-10-11 21:26 ` Jeff King
2016-10-11 21:36 ` Junio C Hamano
2016-10-11 21:47 ` Jeff King
2016-10-11 21:49 ` Junio C Hamano
2017-01-27 12:38 ` Johannes Schindelin [this message]
2017-01-27 12:38 ` [PATCH v2 1/1] reset: support the --stdin option Johannes Schindelin
2017-01-27 17:04 ` Jeff King
2017-01-27 17:34 ` Johannes Schindelin
2017-01-27 17:54 ` Jeff King
2017-01-27 18:30 ` Junio C Hamano
2017-01-27 22:12 ` Jeff King
2017-01-28 0:20 ` Junio C Hamano
2017-01-27 17:30 ` [PATCH v3 0/1] Support `git reset --stdin` Johannes Schindelin
2017-01-27 17:30 ` [PATCH v3 1/1] reset: support the --stdin option Johannes Schindelin
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=cover.1485520718.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=peff@peff.net \
/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).