On Fri, May 17, 2019 at 11:48 PM Emily Shaffer <[email protected]> wrote:
>
> This tutorial covers how to add a new command to Git and, in the
> process, everything from cloning git/git to getting reviewed on the
> mailing list. It's meant for new contributors to go through
> interactively, learning the techniques generally used by the git/git
> development community.

Very nice, thanks! I tried it and I liked it very much.

I noted a few nits that might help improve it a bit.

> +----
> +$ git clone https://github.com/git/git git

Nit: maybe add "$ cd git" after that.

> +Check it out! You've got a command! Nice work! Let's commit this.
> +
> +----
> +$ git add Makefile builtin.h builtin/psuh.c git.c
> +$ git commit -s
> +----

Nit: when building a "git-psuh" binary is created at the root of the
repo which will pollute the `git status` output. The usual way we deal
with that is by adding "/git-psuh" to the ".gitignore" at the root of
the repo.

> +=== Implementation
> +
> +It's probably useful to do at least something besides printing out a string.
> +Let's start by having a look at everything we get.
> +
> +Modify your `cmd_psuh` implementation to dump the args you're passed:

Nit: maybe it could be a bit more clear that the previous printf()
call should be kept as is, otherwise the test added later will fail.

> +----
> +       const char *cfg_name;
> +
> +...
> +
> +       git_config(git_default_config, NULL)

Nit: a ";" is missing at the end of the above line.

> +Let's commit this as well.
> +
> +----
> +$ git commit -sm "psuh: print the current branch"

Nit: maybe add "builtin/psuh.c" at the end of the above line, so that
a `git add builtin/psuh.c` is not needed.

> +....
> +git-psuh(1)
> +===========
> +
> +NAME
> +----
> +git-psuh - Delight users' typo with a shy horse
> +
> +
> +SYNOPSIS
> +--------
> +[verse]
> +'git-psuh'
> +
> +DESCRIPTION
> +-----------
> +...
> +
> +OPTIONS[[OPTIONS]]
> +------------------
> +...
> +
> +OUTPUT
> +------
> +...
> +
> +

Nit: it seems that the above newline could be removed.

Thanks,
Christian.

Reply via email to