summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-04-27 15:10:04 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-27 14:32:29 -0700
commitfda54ef1aa66b54031a37c72a463ef15d6411912 (patch)
tree73f1f78fe2af8219930bf2f8f4cdedf2819ec7b7 /contrib/completion
parentcompletion: refactor diff_index wrappers (diff)
downloadtgif-fda54ef1aa66b54031a37c72a463ef15d6411912.tar.xz
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>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash9
1 files changed, 3 insertions, 6 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 25612655ab..9cea17036e 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -535,20 +535,17 @@ __git_complete_revlist_file ()
# The exception is --committable, which finds the files appropriate commit.
__git_complete_index_file ()
{
- local pfx cur_="$cur"
+ local pfx="" cur_="$cur"
case "$cur_" in
?*/*)
pfx="${cur_%/*}"
cur_="${cur_##*/}"
pfx="${pfx}/"
-
- __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
- ;;
- *)
- __gitcomp_file "$(__git_index_files "$1")" "" "$cur_"
;;
esac
+
+ __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
}
__git_complete_file ()