All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Wincent Colaiuta <win@wincent.com>, Jan Hudec <bulb@ucw.cz>,
	David Kastrup <dak@gnu.org>, Nicolas Pitre <nico@cam.org>,
	Jakub Narebski <jnareb@gmail.com>,
	git@vger.kernel.org
Subject: Re: If you would write git from scratch now, what would you change?
Date: Mon, 26 Nov 2007 19:35:45 -0800	[thread overview]
Message-ID: <7v7ik4e4xa.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20071127010350.GE14735@spearce.org> (Shawn O. Pearce's message of "Mon, 26 Nov 2007 20:03:50 -0500")

"Shawn O. Pearce" <spearce@spearce.org> writes:

> Junio C Hamano <gitster@pobox.com> wrote:
>> Wincent Colaiuta <win@wincent.com> 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@spearce.org>
>
> ;-)

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 '

  reply	other threads:[~2007-11-27  3:36 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-25 21:48 If you would write git from scratch now, what would you change? Jakub Narebski
2007-11-25 22:23 ` Pierre Habouzit
2007-11-26  1:28   ` Steven Walter
2007-11-26  6:11     ` Junio C Hamano
2007-11-26  6:36       ` Adam Roben
2007-11-26 15:32         ` Carlos Rica
2007-11-26 16:40           ` Daniel Barkalow
2007-11-26 16:46 ` Andy Parkins
2007-11-26 17:10   ` Benoit Sigoure
2007-11-26 18:56     ` Jan Hudec
2007-11-26 19:12       ` David Kastrup
2007-11-26 19:34         ` Jan Hudec
2007-11-26 19:50           ` Michael Poole
2007-11-26 20:09             ` Jan Hudec
2007-11-26 20:31               ` Michael Poole
2007-11-26 20:48                 ` Jon Smirl
2007-11-26 20:11     ` Andy Parkins
2007-11-26 19:25   ` Marco Costalba
2007-11-27  1:20     ` Shawn O. Pearce
2007-11-27  1:46       ` Jakub Narebski
2007-11-27  1:58         ` Shawn O. Pearce
2007-11-27 11:39           ` Johannes Schindelin
2007-11-27 23:59             ` [RFC] git-gui USer's Survey 2007 (was: If you would write git from scratch now, what would you change?) Jakub Narebski
2007-11-28 12:32               ` Johannes Schindelin
2007-11-28 15:48                 ` Jason Sewall
2007-11-28 23:25                 ` Jan Hudec
2007-11-28 23:48                   ` Johannes Schindelin
2007-11-29  6:57                     ` Jan Hudec
2007-11-29 12:01                       ` Johannes Schindelin
2007-11-30 17:50                         ` Jan Hudec
2007-11-30 18:25                           ` Marco Costalba
2007-12-01  2:35                           ` Shawn O. Pearce
2007-12-01  2:53                             ` Marco Costalba
2007-11-28 13:18               ` [RFC] git-gui USer's Survey 2007 Sergei Organov
2007-11-27  8:45     ` If you would write git from scratch now, what would you change? Andy Parkins
2007-11-27 13:15       ` Marco Costalba
2007-11-27 23:56         ` Jan Hudec
2007-11-27 17:48       ` Johannes Schindelin
2007-12-04 11:00         ` Andy Parkins
2007-11-27 17:33   ` Jing Xue
2007-11-26 16:48 ` Jon Smirl
2007-11-26 17:11 ` David Kastrup
2007-11-26 19:27   ` Jan Hudec
2007-11-26 20:11     ` Benoit Sigoure
2007-11-26 20:36       ` Jan Hudec
2007-11-26 19:30   ` Nicolas Pitre
2007-11-26 19:34     ` David Kastrup
2007-11-26 19:57       ` Jan Hudec
2007-11-26 20:35         ` David Kastrup
2007-11-26 21:00           ` Jan Hudec
2007-11-26 21:28           ` Nicolas Pitre
2007-11-26 20:45         ` Wincent Colaiuta
2007-11-26 21:24           ` Junio C Hamano
2007-11-26 21:35             ` Nicolas Pitre
2007-11-26 21:47               ` Junio C Hamano
2007-11-26 22:03                 ` Nicolas Pitre
2007-11-27  1:03             ` Shawn O. Pearce
2007-11-27  3:35               ` Junio C Hamano [this message]
2007-11-27  5:10                 ` Steven Grimm
2007-11-26 21:27     ` Johannes Schindelin
2007-11-26 21:39       ` Nicolas Pitre
2007-11-26 21:40         ` Johannes Schindelin
2007-11-27 14:11     ` Andreas Ericsson
2007-11-27 14:38       ` Jakub Narebski
2007-11-26 19:18 ` Dana How
2007-11-26 19:52   ` Nicolas Pitre
2007-11-26 20:17     ` Dana How
2007-11-26 20:55       ` Nicolas Pitre
2007-11-26 22:02         ` Dana How
2007-11-26 22:22           ` Nicolas Pitre
2007-11-26 20:17   ` Jakub Narebski
2007-11-26 20:36     ` Dana How
2007-11-27  1:25   ` Shawn O. Pearce
2007-11-27  5:07     ` Nicolas Pitre
2007-11-27  1:48 ` Shawn O. Pearce
2007-11-27  1:54   ` Junio C Hamano
2007-11-27  1:59     ` Shawn O. Pearce
2007-11-27  2:15       ` Jakub Narebski
2007-11-27 11:47         ` C# binding, was " Johannes Schindelin
2007-11-27  4:58   ` Nicolas Pitre
2007-11-27  5:59     ` Dana How
2007-11-27  6:12       ` Shawn O. Pearce
2007-11-27 16:33     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v7ik4e4xa.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bulb@ucw.cz \
    --cc=dak@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=nico@cam.org \
    --cc=spearce@spearce.org \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.