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

Re: [PATCH 1/2] completion: handle unstuck form of base git options

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jun 22, 2013, 12:30 UTC
Message-ID
<20130622123033.GI20052@goldbirke>
In-Reply-To
<adafd1a0c0d7d059d215d9fd1ea68579525efe6e.1371900318.git.john@keeping.me.uk>
Hi,
On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
Show 5 quoted lines
> git-completion.bash's parsing of the command name relies on everything
> preceding it starting with '-' unless it is the "-c" option.  This
> allows users to use the stuck form of "--work-tree=<path>" and
> "--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
> "--namespace <path>".  Fix this.

I never use these commands, so I looked up what --namespace means. While doing so I noticed that --exec-path takes a path just like these options, so that option should be handled similarly as well.

Otherwise it makes sense.
Gábor
Show 27 quoted lines
> Similarly, the completion only handles the stuck form "--git-dir=<path>"
> and not "--git-dir <path>", so fix this as well.
> 
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
>  contrib/completion/git-completion.bash | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6c3bafe..8fbf941 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2492,9 +2492,10 @@ __git_main ()
>  		i="${words[c]}"
>  		case "$i" in
>  		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
> +		--git-dir)   ((c++)) ; __git_dir="${words[c]}" ;;
>  		--bare)      __git_dir="." ;;
>  		--help) command="help"; break ;;
> -		-c) c=$((++c)) ;;
> +		-c|--work-tree|--namespace) ((c++)) ;;
>  		-*) ;;
>  		*) command="$i"; break ;;
>  		esac
> -- 
> 1.8.3.1.676.gaae6535
> 
Previous: Junio C HamanoNext: SZEDER Gábor
Message 5 of 7 in “completion: handle unstuck form of base git options”
  1. 1/2 completion: handle unstuck form of base git optionsJohn Keeping, Jun 22, 2013
  2. 2/2 completion: learn about --man-pathJohn Keeping, Jun 22, 2013
  3. SZEDER GáborJun 30, 2013
  4. Junio C HamanoJun 30, 2013
  5. SZEDER GáborJun 22, 2013
  6. SZEDER GáborJun 22, 2013
  7. John KeepingJun 28, 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.