git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] reset: support the --stdin option

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Sep 4, 2019, 21:45 UTC
Message-ID
<CAPig+cSw=qt6-b6xoyTGmtKRUdZnb=khy4eNV0_LSSNGu7x2tg@mail.gmail.com>
In-Reply-To
<017945a55a64ebe1913d64919b699adb3f9d5d96.1567633109.git.gitgitgadget@gmail.com>

On Wed, Sep 4, 2019 at 5:38 PM Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 16 quoted lines
> Just like with other Git commands, this option makes it read the paths
> from the standard input. It comes in handy when resetting many, many
> paths at once and wildcards are not an option (e.g. when the paths are
> generated by a tool).
> [...]
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> diff --git a/builtin/reset.c b/builtin/reset.c
> @@ -316,6 +325,38 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
> +       if (read_from_stdin) {
> +               [...]
> +               while (getline_fn(&buf, stdin) != EOF) {
> +                       if (!nul_term_line && buf.buf[0] == '"') {
> +                               strbuf_reset(&unquoted);
> +                               if (unquote_c_style(&unquoted, buf.buf, NULL))
> +                                       die(_("line is badly quoted"));

Perhaps include the offending line in the error message to make it easier for the user to understand what went wrong:

     die(_("line is badly quoted: %s"), buf.buf);
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 3 of 6 in “Teach git reset to optionally read the pathspecs from stdin”
  1. 0/1 Teach git reset to optionally read the pathspecs from stdinJohannes Schindelin via GitGitGadget, Sep 4, 2019
  2. 1/1 reset: support the --stdin optionJohannes Schindelin via GitGitGadget, Sep 4, 2019
  3. Eric SunshineSep 4, 2019
  4. Junio C HamanoSep 4, 2019
  5. Alexandr MiloslavskiySep 5, 2019
  6. Junio C HamanoSep 5, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.