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

Re: [PATCH 1/1] completion: dir-type optargs for am, format-patch

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 8, 2024, 18:37 UTC
Message-ID
<xmqqttnnk6ws.fsf@gitster.g>
In-Reply-To
<8a8dfcfc-3369-42b8-8387-f1af33202b16@smtp-relay.sendinblue.com>
"Britton Leo Kerin" <britton.kerin@gmail.com> writes:
> +	local context_dir=$(__git rev-parse --show-toplevel --show-prefix 2>/dev/null | paste -s -d '/' 2>/dev/null)
Is there a practical difference with the above with
	context_dir=$(pwd)
other than that it will give an empty string outside a git working tree?
If not, I suspect
	local inside
	inside=$(__git rev-parse --is-inside-work-tree) &&
	test "$inside" = true || return
	local context_dir=$(pwd)
might be clearer on the intent.
> +	[ -d "$context_dir" ] || return
> +
> +	COMPREPLY=$(cd $context_dir 2>/dev/null && compgen -d -- "$cur_")
Can $context_dir contain $IFS whitespaces here?
> +}
Previous: Britton Leo Kerin
Message 2 of 2 in “completion: dir-type optargs for am, format-patch”
  1. 1/1 completion: dir-type optargs for am, format-patchBritton Leo Kerin, Jan 7, 2024
  2. Junio C HamanoJan 8, 2024

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.