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

Re: [RFC/PATCH] rev-parse(1): logically group options

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 19, 2013, 20:35 UTC
Message-ID
<7v4nbquw3l.fsf@alter.siamese.dyndns.org>
In-Reply-To
<8ab5f3c276e6f623a8056674c9306334efc9fefe.1374174438.git.john@keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
Show 9 quoted lines
> The options section of the git-rev-parse manual page has grown
> organically so that there now does not seem to be much logic behind the
> ordering of the options.  It also does not make it clear that certain
> options must appear first on the command line.
>
> Address this by reorganising the options into groups with subheadings.
> The text of option descriptions does not change.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
The idea to introduce a general grouping makes a lot of sense, I think.
Show 10 quoted lines
> +Operation Modes
> +~~~~~~~~~~~~~~~
> +
> +Each of these options must appear first on the command line.
> +
> +--local-env-vars::
> +	List the GIT_* environment variables that are local to the
> +	repository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).
> +	Only the names of the variables are listed, not their value,
> +	even if they are set.

Honestly speaking, "must appear first" for "--local-env-vars" is a bug in implementations of this option, I think. It does not make sense to ask

	git rev-parse --local-env-vars -- Makefile

and the command operates on "--" and "Makefile" in the normal operation mode, not "local-env-vars" mode.

Show 14 quoted lines
> +
>  --parseopt::
>  	Use 'git rev-parse' in option parsing mode (see PARSEOPT section below).
>  
> +--resolve-git-dir <path>::
> +	Check if <path> is a valid repository or a gitfile that
> +	points at a valid repository, and print the location of the
> +	repository.  If <path> is a gitfile then the resolved path
> +	to the real repository is printed.
> +
> +--sq-quote::
> +	Use 'git rev-parse' in shell quoting mode (see SQ-QUOTE
> +	section below). In contrast to the `--sq` option below, this
> +	mode does only quoting. Nothing else is done to command input.
Show 22 quoted lines
> +Options for Input
> +~~~~~~~~~~~~~~~~~
>  
> +--show-toplevel::
> +	Show the absolute path of the top-level directory.
> +
> +--show-cdup::
> +	When the command is invoked from a subdirectory, show the
> +	path of the top-level directory relative to the current
> +	directory (typically a sequence of "../", or an empty string).
> +
>  --is-inside-git-dir::
>  	When the current working directory is below the repository
>  	directory print "true", otherwise "false".
> @@ -188,17 +219,10 @@ print a message to stderr and exit with nonzero status.
>  --is-bare-repository::
>  	When the repository is bare print "true", otherwise "false".
>  
> +--show-prefix::
> +	When the command is invoked from a subdirectory, show the
> +	path of the current directory relative to the top-level
> +	directory.

I am not sure if --show-*, --is-*, and --git-dir belongs to "options for input". They are truly kitchen sink options to ask for various aspects of the repository and directory, and it may be equally valid (or even more valid) to consider them as separate operation modes.

Previous: John KeepingNext: John Keeping
Message 2 of 6 in “rev-parse(1): logically group options”
  1. rev-parse(1): logically group optionsJohn Keeping, Jul 18, 2013
  2. Junio C HamanoJul 19, 2013
  3. 0/2 Improvements to rev-parse option handlingJohn Keeping, Jul 21, 2013
  4. 1/2 rev-parse: remove restrictions on some optionsJohn Keeping, Jul 21, 2013
  5. 2/2 rev-parse(1): logically group optionsJohn Keeping, Jul 21, 2013
  6. Junio C HamanoJul 22, 2013

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.