mirror of
https://github.com/git/git.git
synced 2024-11-01 06:47:52 +01:00
completion: refactor __git_complete_index_file()
The calls to __gitcomp_file() are essentially the same, but with different prefix. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f825972c38
commit
fda54ef1aa
1 changed files with 3 additions and 6 deletions
|
@ -535,20 +535,17 @@ __git_complete_revlist_file ()
|
||||||
# The exception is --committable, which finds the files appropriate commit.
|
# The exception is --committable, which finds the files appropriate commit.
|
||||||
__git_complete_index_file ()
|
__git_complete_index_file ()
|
||||||
{
|
{
|
||||||
local pfx cur_="$cur"
|
local pfx="" cur_="$cur"
|
||||||
|
|
||||||
case "$cur_" in
|
case "$cur_" in
|
||||||
?*/*)
|
?*/*)
|
||||||
pfx="${cur_%/*}"
|
pfx="${cur_%/*}"
|
||||||
cur_="${cur_##*/}"
|
cur_="${cur_##*/}"
|
||||||
pfx="${pfx}/"
|
pfx="${pfx}/"
|
||||||
|
|
||||||
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
__gitcomp_file "$(__git_index_files "$1")" "" "$cur_"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_complete_file ()
|
__git_complete_file ()
|
||||||
|
|
Loading…
Reference in a new issue