Keep all info in command-list.txt in git binary
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v7 Latest13 patches 5 repliesIn review
- v613 patches 5 repliesSuperseded
- v510 patches 2 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 6 patches | 15 replies | Superseded | |
| v2 | 6 patches | 9 replies | Superseded | |
| v1 | 5 patches | 22 replies | Superseded |
Patches in v7 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | generate-cmds.sh: factor out synopsis extract codegenerate-cmdlist.sh | +11 | 0 replies | |
| 2/13 | generate-cmds.sh: export all commands to command-list.h.gitignore Makefile command-list.txt +1 more | +75 | 0 replies | |
| 3/13 | help: use command-list.h for common command listMakefile command-list.txt generate-cmdlist.sh +2 more | +122 | 0 replies | |
| 4/13 | Remove common-cmds.h.gitignore Makefile generate-cmdlist.sh | +9 | 0 replies | |
| 5/13 | git.c: convert --list-* to --list-cmds=*contrib/ git.c t/ | +33 | 0 replies | |
| 6/13 | git --list-cmds: collect command list in a string_listgit.c | +17 | 0 replies | |
| 7/13 | completion: implement and use --list-cmds=main,otherscontrib/ git.c help.c +1 more | +41 | 3 replies | |
| 8/13 | git: support --list-cmds=list-<category>generate-cmdlist.sh git.c help.c +1 more | +49 | 0 replies | |
| 9/13 | help: add "-a --verbose" to list all commands with synopsisDocumentation/ builtin/ help.c +2 more | +37 | 0 replies | |
| 10/13 | help: use command-list.txt for the source of guidesDocumentation/ Documentation/ Documentation/ +7 more | +54 | 0 replies | |
| 11/13 | command-list.txt: documentation and guide linecommand-list.txt | +44 | 0 replies | |
| 12/13 | completion: let git provide the completable command listcommand-list.txt contrib/ t/ | +48 | 2 replies | |
| 13/13 | completion: allow to customize the completable command listDocumentation/ contrib/ git.c +2 more | +73 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.
Cover letter [PATCH v7 00/13] Keep all info in command-list.txt in git binary
v7 is mostly code cleanup plus one more change:
git-completion.bash now always checks completion.commands config key. This makes it much more convenient to customize the command complete list. You only have to fall back to setting $GIT_COMPLETION_CMD_GROUPS when you have very special needs.
Interdiff
Documentation/config.txt +10 -0
@@ -1343,6 +1343,16 @@ credential.<url>.*:: credentialCache.ignoreSIGHUP:: Tell git-credential-cache--daemon to ignore SIGHUP, instead of quitting. +completion.commands:: + This is only used by git-completion.bash to add or remove + commands from the complete list. Normally only porcelain + commands and a few select others are in the complete list. You + can add more commands, separated by space, in this + variable. Prefixing a command with '-' will remove it from + the existing list. ++ +This variable should not be per-repository. + include::diff-config.txt[] difftool.<tool>.path::
contrib/completion/git-completion.bash +4 -13
@@ -50,10 +50,10 @@ # # GIT_COMPLETION_CMD_GROUPS=main,others # -# Or you could go with defaults add some extra commands specified -# in the configuration variable completion.commands [1] with +# Or you could go with main porcelain only and extra commands in +# the configuration variable completion.commands with # -# GIT_COMPLETION_CMD_GROUPS=mainporcelain,others,list-complete,config +# GIT_COMPLETION_CMD_GROUPS=mainporcelain,config # # Or go completely custom group with #
@@ -61,15 +61,6 @@ # # Or you could even play with other command categories found in # command-list.txt. -# -# [1] Note that completion.commands should not be per-repository -# since the command list is generated once and cached. -# -# completion.commands could be used to exclude commands as -# well. If a command in this list begins with '-', then it -# will be excluded from the list of commands gathered by the -# groups specified before "config" in -# $GIT_COMPLETION_CMD_GROUPS. case "$COMP_WORDBREAKS" in *:*) : great ;;
@@ -876,7 +867,7 @@ __git_commands () { then git --list-cmds="$GIT_COMPLETION_CMD_GROUPS" else - git --list-cmds=list-mainporcelain,others,list-complete + git --list-cmds=list-mainporcelain,others,list-complete,config fi ;; all)
generate-cmdlist.sh +4 -4
@@ -9,7 +9,7 @@ command_list () { grep -v '^#' "$1" } -get_categories() { +get_categories () { tr ' ' '\n'| grep -v '^$' | sort |
@@ -32,7 +32,7 @@ get_synopsis () { }' "Documentation/$1.txt" } -define_categories() { +define_categories () { echo echo "/* Command categories */" bit=0
@@ -45,7 +45,7 @@ define_categories() { test "$bit" -gt 32 && die "Urgh.. too many categories?" } -define_category_names() { +define_category_names () { echo echo "/* Category names */" echo "static const char *category_names[] = {"
@@ -60,7 +60,7 @@ define_category_names() { echo "};" } -print_command_list() { +print_command_list () { echo "static struct cmdname_help command_list[] = {" command_list "$1" |
git.c +11 -4
@@ -38,6 +38,13 @@ static int use_pager = -1;static void list_builtins (struct string_list *list,unsigned int exclude_option); +static int match_token (const char *spec,int len,const char *token) +{ +int token_len =strlen (token); + +return len == token_len && !strncmp (spec, token, token_len); +} +static int list_cmds (const char *spec) {struct string_list list =STRING_LIST_INIT_DUP ;
@@ -47,13 +54,13 @@ static int list_cmds(const char *spec)const char *sep =strchrnul (spec,',' );int len = sep - spec; -if (len ==8 && !strncmp (spec,"builtins" ,8 )) +if (match_token (spec, len,"builtins" ))list_builtins (&list,0 ); -else if (len ==4 && !strncmp (spec,"main" ,4 )) +else if (match_token (spec, len,"main" ))list_all_main_cmds (&list); -else if (len ==6 && !strncmp (spec,"others" ,6 )) +else if (match_token (spec, len,"others" ))list_all_other_cmds (&list); -else if (len ==6 && !strncmp (spec,"config" ,6 )) +else if (match_token (spec, len,"config" ))list_cmds_by_config (&list);else if (len >5 && !strncmp (spec,"list-" ,5 )) {struct strbuf sb =STRBUF_INIT ;
Nguyễn Thái Ngọc Duy (13):
generate-cmds.sh: factor out synopsis extract code generate-cmds.sh: export all commands to command-list.h
help: use command-list.h for common command list Remove common-cmds.h
git.c: convert --list-* to --list-cmds=*
git --list-cmds: collect command list in a string_list
completion: implement and use --list-cmds=main,others
git: support --list-cmds=list-<category>
help: add "-a --verbose" to list all commands with synopsis
help: use command-list.txt for the source of guides command-list.txt: documentation and guide line
completion: let git provide the completable command list
completion: allow to customize the completable command list
.gitignore | 2 +- Documentation/config.txt | 10 + Documentation/git-help.txt | 4 +- Documentation/gitattributes.txt | 2 +- Documentation/gitmodules.txt | 2 +- Documentation/gitrevisions.txt | 2 +- Makefile | 16 +- builtin/help.c | 39 +--- command-list.txt | 111 ++++++++--- contrib/completion/git-completion.bash | 160 +++++++--------- generate-cmdlist.sh | 126 ++++++++----- git.c | 68 ++++++- help.c | 244 ++++++++++++++++++++++--- help.h | 10 + t/t0012-help.sh | 26 ++- t/t9902-completion.sh | 5 +- 16 files changed, 573 insertions(+), 254 deletions(-)
Signature · 1 line
2.17.0.705.g3525833791