Skip to content

Commit fda54ef

Browse files
felipecgitster
authored andcommitted
completion: refactor __git_complete_index_file()
The calls to __gitcomp_file() are essentially the same, but with different prefix. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f825972 commit fda54ef

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,20 +535,17 @@ __git_complete_revlist_file ()
535535
# The exception is --committable, which finds the files appropriate commit.
536536
__git_complete_index_file ()
537537
{
538-
local pfx cur_="$cur"
538+
local pfx="" cur_="$cur"
539539

540540
case "$cur_" in
541541
?*/*)
542542
pfx="${cur_%/*}"
543543
cur_="${cur_##*/}"
544544
pfx="${pfx}/"
545-
546-
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
547-
;;
548-
*)
549-
__gitcomp_file "$(__git_index_files "$1")" "" "$cur_"
550545
;;
551546
esac
547+
548+
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
552549
}
553550

554551
__git_complete_file ()

0 commit comments

Comments
 (0)