"Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes: > Junio C Hamano <gitster@xxxxxxxxx> wrote: >> Wincent Colaiuta <win@xxxxxxxxxxx> writes: >> > >> > $ git-<tab> >> > Display all 146 possibilities? (y or n) >> >> The tab completion for bash and zsh would also help you here, but I see >> there are quite a few commands that should not be there, and it's time >> to clean it up. > ... >> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash >> index cad842a..1bba68b 100755 >> --- a/contrib/completion/git-completion.bash >> +++ b/contrib/completion/git-completion.bash >> @@ -359,6 +359,15 @@ __git_commands () >> upload-pack) : plumbing;; >> write-tree) : plumbing;; >> verify-tag) : plumbing;; >> + annotate) : use blame;; >> + checkout-index) : plumbing;; >> + diff-stages) : plumbing;; >> + get-tar-commit-id) : plumbing;; >> + lost-found) : deprecated;; >> + rebase--interactive) : plumbing;; >> + relink) : obsolete;; >> + whatchanged) : plumbing;; >> + verify-pack) : plumbing;; >> *) echo $i;; >> esac >> done > > Ack'd-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> > > ;-) Seriously, speaking I find this "negative" list ugly. I am wondering if it makes more sense to use positive "Porcelain" list, or perhaps even "The most commonly used" list from "git help" output. Here is an alternate attempt to it. --- Documentation/cmd-list.perl | 59 ++++++++++++------------ Makefile | 2 +- contrib/completion/git-completion.bash | 77 ++------------------------------ generate-cmdlist.sh | 34 ++------------ 4 files changed, 40 insertions(+), 132 deletions(-) diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl index b709551..a966b5e 100755 --- a/Documentation/cmd-list.perl +++ b/Documentation/cmd-list.perl @@ -26,10 +26,11 @@ sub format_one { if (!defined $description) { die "No description found in $name.txt"; } + if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) { print $out "gitlink:$name\[1\]::\n\t"; - if ($attr) { - print $out "($attr) "; + if ($attr =~ /deprecated/) { + print $out "(deprecated) "; } print $out "$text.\n\n"; } @@ -75,27 +76,27 @@ for my $cat (qw(ancillaryinterrogators # The following list is sorted with "sort -d" to make it easier # to find entry in the resulting git.html manual page. __DATA__ -git-add mainporcelain +git-add mainporcelain common git-am mainporcelain git-annotate ancillaryinterrogators -git-apply plumbingmanipulators +git-apply plumbingmanipulators common git-archimport foreignscminterface -git-archive mainporcelain -git-bisect mainporcelain +git-archive mainporcelain common +git-bisect mainporcelain common git-blame ancillaryinterrogators -git-branch mainporcelain +git-branch mainporcelain common git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers -git-checkout mainporcelain +git-checkout mainporcelain common git-checkout-index plumbingmanipulators git-check-ref-format purehelpers git-cherry ancillaryinterrogators -git-cherry-pick mainporcelain +git-cherry-pick mainporcelain common git-citool mainporcelain git-clean mainporcelain -git-clone mainporcelain -git-commit mainporcelain +git-clone mainporcelain common +git-commit mainporcelain common git-commit-tree plumbingmanipulators git-config ancillarymanipulators git-count-objects ancillaryinterrogators @@ -104,12 +105,12 @@ git-cvsimport foreignscminterface git-cvsserver foreignscminterface git-daemon synchingrepositories git-describe mainporcelain -git-diff mainporcelain +git-diff mainporcelain common git-diff-files plumbinginterrogators git-diff-index plumbinginterrogators git-diff-tree plumbinginterrogators git-fast-import ancillarymanipulators -git-fetch mainporcelain +git-fetch mainporcelain common git-fetch-pack synchingrepositories git-filter-branch ancillarymanipulators git-fmt-merge-msg purehelpers @@ -118,24 +119,24 @@ git-format-patch mainporcelain git-fsck ancillaryinterrogators git-gc mainporcelain git-get-tar-commit-id ancillaryinterrogators -git-grep mainporcelain +git-grep mainporcelain common git-gui mainporcelain git-hash-object plumbingmanipulators git-http-fetch synchelpers git-http-push synchelpers git-imap-send foreignscminterface git-index-pack plumbingmanipulators -git-init mainporcelain +git-init mainporcelain common git-instaweb ancillaryinterrogators gitk mainporcelain -git-log mainporcelain +git-log mainporcelain common git-lost-found ancillarymanipulators deprecated git-ls-files plumbinginterrogators git-ls-remote plumbinginterrogators git-ls-tree plumbinginterrogators git-mailinfo purehelpers git-mailsplit purehelpers -git-merge mainporcelain +git-merge mainporcelain common git-merge-base plumbinginterrogators git-merge-file plumbingmanipulators git-merge-index plumbingmanipulators @@ -144,7 +145,7 @@ git-mergetool ancillarymanipulators git-merge-tree ancillaryinterrogators git-mktag plumbingmanipulators git-mktree plumbingmanipulators -git-mv mainporcelain +git-mv mainporcelain common git-name-rev plumbinginterrogators git-pack-objects plumbingmanipulators git-pack-redundant plumbinginterrogators @@ -152,13 +153,13 @@ git-pack-refs ancillarymanipulators git-parse-remote synchelpers git-patch-id purehelpers git-peek-remote purehelpers deprecated -git-prune ancillarymanipulators +git-prune ancillarymanipulators common git-prune-packed plumbingmanipulators -git-pull mainporcelain -git-push mainporcelain +git-pull mainporcelain common +git-push mainporcelain common git-quiltimport foreignscminterface git-read-tree plumbingmanipulators -git-rebase mainporcelain +git-rebase mainporcelain common git-receive-pack synchelpers git-reflog ancillarymanipulators git-relink ancillarymanipulators @@ -166,28 +167,28 @@ git-remote ancillarymanipulators git-repack ancillarymanipulators git-request-pull foreignscminterface git-rerere ancillaryinterrogators -git-reset mainporcelain -git-revert mainporcelain +git-reset mainporcelain common +git-revert mainporcelain common git-rev-list plumbinginterrogators git-rev-parse ancillaryinterrogators -git-rm mainporcelain +git-rm mainporcelain common git-runstatus ancillaryinterrogators git-send-email foreignscminterface git-send-pack synchingrepositories git-shell synchelpers git-shortlog mainporcelain -git-show mainporcelain -git-show-branch ancillaryinterrogators +git-show mainporcelain common +git-show-branch ancillaryinterrogators common git-show-index plumbinginterrogators git-show-ref plumbinginterrogators git-sh-setup purehelpers git-stash mainporcelain -git-status mainporcelain +git-status mainporcelain common git-stripspace purehelpers git-submodule mainporcelain git-svn foreignscminterface git-symbolic-ref plumbingmanipulators -git-tag mainporcelain +git-tag mainporcelain common git-tar-tree plumbinginterrogators deprecated git-unpack-file plumbinginterrogators git-unpack-objects plumbingmanipulators diff --git a/Makefile b/Makefile index ccf522a..ca1c2f5 100644 --- a/Makefile +++ b/Makefile @@ -804,7 +804,7 @@ git-merge-subtree$X: git-merge-recursive$X $(BUILT_INS): git$X $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@ -common-cmds.h: ./generate-cmdlist.sh +common-cmds.h: ./generate-cmdlist.sh Documentation/cmd-list.perl common-cmds.h: $(wildcard Documentation/git-*.txt) $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@ diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 599b2fc..d54b415 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -287,79 +287,10 @@ __git_commands () echo "$__git_commandlist" return fi - local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ ') - do - case $i in - add--interactive) : plumbing;; - applymbox) : ask gittus;; - applypatch) : ask gittus;; - archimport) : import;; - cat-file) : plumbing;; - check-attr) : plumbing;; - check-ref-format) : plumbing;; - commit-tree) : plumbing;; - cvsexportcommit) : export;; - cvsimport) : import;; - cvsserver) : daemon;; - daemon) : daemon;; - diff-files) : plumbing;; - diff-index) : plumbing;; - diff-tree) : plumbing;; - fast-import) : import;; - fsck-objects) : plumbing;; - fetch--tool) : plumbing;; - fetch-pack) : plumbing;; - fmt-merge-msg) : plumbing;; - for-each-ref) : plumbing;; - hash-object) : plumbing;; - http-*) : transport;; - index-pack) : plumbing;; - init-db) : deprecated;; - local-fetch) : plumbing;; - mailinfo) : plumbing;; - mailsplit) : plumbing;; - merge-*) : plumbing;; - mktree) : plumbing;; - mktag) : plumbing;; - pack-objects) : plumbing;; - pack-redundant) : plumbing;; - pack-refs) : plumbing;; - parse-remote) : plumbing;; - patch-id) : plumbing;; - peek-remote) : plumbing;; - prune) : plumbing;; - prune-packed) : plumbing;; - quiltimport) : import;; - read-tree) : plumbing;; - receive-pack) : plumbing;; - reflog) : plumbing;; - repo-config) : plumbing;; - rerere) : plumbing;; - rev-list) : plumbing;; - rev-parse) : plumbing;; - runstatus) : plumbing;; - sh-setup) : internal;; - shell) : daemon;; - send-pack) : plumbing;; - show-index) : plumbing;; - ssh-*) : transport;; - stripspace) : plumbing;; - svn) : import export;; - symbolic-ref) : plumbing;; - tar-tree) : deprecated;; - unpack-file) : plumbing;; - unpack-objects) : plumbing;; - update-index) : plumbing;; - update-ref) : plumbing;; - update-server-info) : daemon;; - upload-archive) : plumbing;; - upload-pack) : plumbing;; - write-tree) : plumbing;; - verify-tag) : plumbing;; - *) echo $i;; - esac - done + git help | sed -e ' + 1,/^The most commonly used git/d + s/^ *\([^ ][^ ]*\)[ ].*/\1/ + ' } __git_commandlist= __git_commandlist="$(__git_commands 2>/dev/null)" diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 17df47b..28f9749 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -9,35 +9,11 @@ struct cmdname_help static struct cmdname_help common_cmds[] = {" -sort <<\EOF | -add -apply -archive -bisect -branch -checkout -cherry-pick -clone -commit -diff -fetch -grep -init -log -merge -mv -prune -pull -push -rebase -reset -revert -rm -show -show-branch -status -tag -EOF +sed -n -e ' + 1,/__DATA__/d + s/^git-\([^ ]*\)[ ].*[ ]common/\1/p +' Documentation/cmd-list.perl | +sort | while read cmd do sed -n ' - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html