From: Junio C Hamano Date: Mon, 08 Jan 2024 18:37:55 GMT Subject: Re: [PATCH 1/1] completion: dir-type optargs for am, format-patch Message-ID: In-Reply-To: <8a8dfcfc-3369-42b8-8387-f1af33202b16@smtp-relay.sendinblue.com> "Britton Leo Kerin" 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? > +}