Subject: Re: [PATCH 1/3] myfirstcontrib: add 'psuh' to command-list.txt

From: SZEDER Gábor <[email-masked]>
Date: Sat, 26 Oct 2019 10:00:57 +0200

On Fri, Oct 25, 2019 at 06:08:57PM -0700, Jonathan Nieder wrote:
> > Users can discover commands and their brief usage by running 'git help
> > git' or 'git help -a'; both of these pages list all available commands
> > based on the contents of 'command-list.txt'. That means adding a new
> > command there is an important part of the new command process, and
> > therefore belongs in the new command tutorial.
> 
> Makes sense.
> 
> Not about this patch: is there a way to detect this automatically?
> E.g. if a command in git.c::commands doesn't appear in
> command-list.txt, could we make Git fail "make test"?

We almost detect this already:

  $ sed -i -e '/^git-bisect/d' command-list.txt 
  $ make check-docs
  make -C Documentation lint-docs
  make[1]: Entering directory '/home/szeder/src/git/Documentation'
      GEN cmd-list.made
      GEN doc.dep
  make[2]: Entering directory '/home/szeder/src/git'
  make[2]: 'GIT-VERSION-FILE' is up to date.
  make[2]: Leaving directory '/home/szeder/src/git'
  make[2]: Entering directory '/home/szeder/src/git'
  make[2]: 'GIT-VERSION-FILE' is up to date.
  make[2]: Leaving directory '/home/szeder/src/git'
      LINT lint-docs
  make[1]: Leaving directory '/home/szeder/src/git/Documentation'
  no link: git-bisect
  $ echo $?
  0

See that last "no link: git-bisect" line?  That's what happened to
catch my eyes when Derrick forgot to add his new 'sparse-checkout'
builtin to 'command-list.txt'.  I still haven't looked up what that
'no link' is supposed to mean, but if it were an error, then we would
have surely detected the missing entry in 'command-list.txt' in out CI
builds.

Another possibility would be to auto-generate that long list of
'cmd_foo()' function declaration in 'builtin.h' from
'command-list.txt', by adding a 'builtin' attribute to mark builtin
commands.