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

Re: [PATCH] Documentation: update-index: -z applies also to --index-info

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 8, 2010, 02:49 UTC
Message-ID
<7viq1dwg8v.fsf@alter.siamese.dyndns.org>
In-Reply-To
<337062f16e5b354be20b0af53a63f5c540ab0eb8.1286480355.git.bert.wesarg@googlemail.com>
Bert Wesarg <bert.wesarg@googlemail.com> writes:
Show 13 quoted lines
> diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
> index 74d1d49..0999950 100644 Documentation/git-update-index.txt
> --- a/Documentation/git-update-index.txt
> +++ b/Documentation/git-update-index.txt
> @@ -18,9 +18,9 @@ SYNOPSIS
>  	     [--skip-worktree | --no-skip-worktree]
>  	     [--ignore-submodules]
>  	     [--really-refresh] [--unresolve] [--again | -g]
> -	     [--info-only] [--index-info]
> -	     [-z] [--stdin]
> +	     [--info-only]
>  	     [--verbose]
> +	     [[-z] --stdin | --index-info]

Hmm, this requires | to bind tighter than [] around -z, but that is a bit counterintuitive.

Also, you can put -z much earlier, e.g. "update-index -z --add --stdin", and your version gives a false impression that we do not allow that.

Writing it as "[-z] [--stdin | --index-info]" would be much easier to read, even though it won't convey that -z will be no-op unless we are reading from the standard input, either with --stdin or --index-info.

I actually think we can easily lift the "must be at the end" limitation from both codepaths.

Move the --stdin codepath to a separate helper like read_index_info(), remove the limitation, and add a new limitation that --stdin/--index-info can be given only once (as the reader will read thru EOF and the second call to the reader won't help us). And do the reading after processing all the command line stuff (i.e. move read_index_info() call after the option parsing loop), to allow "update-index --stdin --add hello.c" to add new paths read from standard input and also hello.c was given from the command line.

Wouldn't it make much more sense to spend brain cycles to write and review such a patch, rather than documenting an unnecessary limitation?

Hmm?
Previous: Bert WesargNext: Bert Wesarg
Message 11 of 13 in “Documentation: update-index: -z applies also to --index-info”
  1. Documentation: update-index: -z applies also to --index-infoBert Wesarg, Oct 7, 2010
  2. Štěpán NěmecOct 7, 2010
  3. Bert WesargOct 7, 2010
  4. Bert WesargOct 7, 2010
  5. Jonathan NiederOct 7, 2010
  6. Štěpán NěmecOct 7, 2010
  7. Documentation: update-index: -z applies also to --index-infoBert Wesarg, Oct 7, 2010
  8. Štěpán NěmecOct 7, 2010
  9. Bert WesargOct 7, 2010
  10. Documentation: update-index: -z applies also to --index-infoBert Wesarg, Oct 7, 2010
  11. Junio C HamanoOct 8, 2010
  12. Bert WesargOct 8, 2010
  13. Documentation: update-index: -z applies also to --index-infoBert Wesarg, Oct 8, 2010

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.