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

Re: [PATCH v5] git-completion.bash: add support for path completion

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 13, 2013, 22:46 UTC
Message-ID
<7vzk0chfal.fsf@alter.siamese.dyndns.org>
In-Reply-To
<50F15CB9.5090603@gmail.com>
Manlio Perillo <manlio.perillo@gmail.com> writes:
Show 9 quoted lines
>> +	# Skip "git" (first argument)
>> +	for ((i=1; i < ${#words[@]}; i++)); do
>> +		word="${words[i]}"
>> +
>> +		case "$word" in
>> +			--)
>
> Sorry, I have incorrectly (again) indented the case labels.
> I have now configured my editor to correctly indent this.
Yeah, thanks for spotting.

I wouldn't worry *too* much about the style in this script at this point, though. It uses a style on its own that is totally different from the rest of the system (e.g. "[" instead of "test", semicolon in "if ...; then", etc.) and it probably is better to emulate the surrounding code, and leave the style "fixes" to a separate topic, if we want to (as a contrib/ material that is not POSIX but bash specific, I do not know if that is even worth it).

Show 16 quoted lines
>> +				# Good; we can assume that the following are only non
>> +				# option arguments.
>> +				((c = 0))
>> +				;;
>
> Here I was thinking to do something like this (not tested):
>
> 		-*)
> 			if [ -n ${2-} ]; then
> 				# Assume specified git command only
>                                 # accepts simple options
> 				# (without arguments)
> 				((c = 0))
>
> Since git mv only accepts simple options, this will make the use of '--'
> not required.
Unless you have a file whose name begins with a dash, perhaps?
Previous: Manlio PerilloNext: Felipe Contreras
Message 6 of 9 in “git-completion.bash: add support for path completion”
  1. git-completion.bash: add support for path completionManlio Perillo, Jan 11, 2013
  2. Junio C HamanoJan 11, 2013
  3. Manlio PerilloJan 12, 2013
  4. Junio C HamanoJan 13, 2013
  5. Manlio PerilloJan 12, 2013
  6. Junio C HamanoJan 13, 2013
  7. Felipe ContrerasApr 21, 2013
  8. Manlio PerilloApr 23, 2013
  9. Felipe ContrerasApr 27, 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.