summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-09-12 19:43:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-09-12 20:45:29 (GMT)
commitaeeb978ba6c757dddc1097fc4de96c0bc1c1e338 (patch)
tree06f3a0effe0038b67ddf97b8a810c7ff5f4c3924 /contrib
parent2b9bd488ae09dc89f02be7d73f3710ee2ea7325c (diff)
downloadgit-aeeb978ba6c757dddc1097fc4de96c0bc1c1e338.zip
git-aeeb978ba6c757dddc1097fc4de96c0bc1c1e338.tar.gz
git-aeeb978ba6c757dddc1097fc4de96c0bc1c1e338.tar.bz2
completion: teach archive to use __gitcomp_builtin
Currently, _git_archive() uses a hardcoded list of options for its completion. However, we can use __gitcomp_builtin() to get a dynamically generated list of completions instead. Teach _git_archive() to use __gitcomp_builtin() so that newly implemented options in archive will be automatically completed without any mucking around in git-completion.bash. While we're at it, teach it to complete the missing `--worktree-attributes` option as well. Unfortunately, since some args are passed through from cmd_archive() to write_archive() (which calls parse_archive_args()), there's no way that a `--git-completion-helper` arg can end up reaching parse_archive_args() since the first call to parse_options() will end up calling exit(0). As a result, we have to carry the options supported by write_archive() in the hardcoded string. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash5
1 files changed, 1 insertions, 4 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 365edff..7b1ab46 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1250,10 +1250,7 @@ _git_archive ()
return
;;
--*)
- __gitcomp "
- --format= --list --verbose
- --prefix= --remote= --exec= --output
- "
+ __gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes"
return
;;
esac