Skip to content

Commit aeeb978

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b9bd48 commit aeeb978

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

contrib/completion/git-completion.bash

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,10 +1250,7 @@ _git_archive ()
12501250
return
12511251
;;
12521252
--*)
1253-
__gitcomp "
1254-
--format= --list --verbose
1255-
--prefix= --remote= --exec= --output
1256-
"
1253+
__gitcomp_builtin archive "--format= --list --verbose --prefix= --worktree-attributes"
12571254
return
12581255
;;
12591256
esac

0 commit comments

Comments
 (0)