Thread (1 message) 1 message, 1 author, 2024-01-08

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

From: Junio C Hamano <hidden>
Date: 2024-01-08 18:38:03

"Britton Leo Kerin" [off-list ref] 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?
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help