git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] documentation: add lab for first contribution

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 21, 2019, 10:52 UTC
Message-ID
<xmqqr29vbpge.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190419165709.123502-1-emilyshaffer@google.com>
Emily Shaffer <emilyshaffer@google.com> writes:
Show 8 quoted lines
> 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.
>
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---

I think a stray "lab" remains in the title of the patch. They seem to have disappeared from all the other places, and "tutorial" is consistently used, which is good.

My eyes have lost freshness on this topic, so my review tonight is bound to be (much) less thorough than the previous round.

> +- `Documentation/SubmittingPatches`
> +- `Documentation/howto/new-command.txt`
Good (relative to the earlier one, these are set in monospace).
Show 6 quoted lines
> +
> +== Getting Started
> +
> +=== Pull the Git codebase
> +
> +Git is mirrored in a number of locations. https://git-scm.com/downloads
Perhaps URLs should also be set in monospace?
> +NOTE: When you are developing the Git project, it's preferred that you use the
> +`DEVELOPER flag`; if there's some reason it doesn't work for you, you can turn

I do not think you want to set 'flag' in monospace, too. i.e. s| flag`|` flag|;

Show 6 quoted lines
> +This commit message is intentionally formatted to 72 columns per line,
> +starts with a single line as "commit message subject" that is written as
> +if to command the codebase to do something (add this, teach a command
> +that). The body of the message is designed to add information about the
> +commit that is not readily deduced from reading the associated diff,
> +such as answering the question "why?".
Nicely written.
Show 9 quoted lines
> +	git_config(git_default_config, NULL)
> +	if (git_config_get_string_const("user.name", &cfg_name) > 0)
> +	{
> +		printf(_("No name is found in config\n"));
> +	}
> +	else
> +	{
> +		printf(_("Your name: %s\n"), cfg_name);
> +	}

Style. Opening braces "{" for control structures are never be on its own line, and else comes on the same line as closing "}" of if, i.e.

	if (...) {
		print ...
	} else {
		print ...
	}

Or just get rid of braces if you are not going to extend one (or both) of if/else blocks into multi-statement blocks.

Show 24 quoted lines
> +----
> +
> +`git_config()` will grab the configuration from config files known to Git and
> +apply standard precedence rules. `git_config_get_string_const()` will look up
> +a specific key ("user.name") and give you the value. There are a number of
> +single-key lookup functions like this one; you can see them all (and more info
> +about how to use `git_config()`) in `Documentation/technical/api-config.txt`.
> +
> +You should see that the name printed matches the one you see when you run:
> +
> +----
> +$ git config --get user.name
> +----
> +
> +Great! Now we know how to check for values in the Git config. Let's commit this
> +too, so we don't lose our progress.
> +
> +----
> +$ git add builtin/psuh.c
> +$ git commit -sm "psuh: show parameters & config opts"
> +----
> +
> +NOTE: Again, the above is for sake of brevity in this tutorial. In a real change
> +you should not use `-m` but instead use the editor to write a verbose message.

We never encourge people to write irrelevant things or obvious things that do not have to be said. But a single-liner message rarely is sufficient to convey "what motivated the change, and why the change is done in the way seen in the patch" in a meaningful way.

i.e. s|verbose|meaningful|;
Show 6 quoted lines
> +Create your test script and mark it executable:
> +
> +----
> +$ touch t/t9999-psuh-tutorial.sh
> +$ chmod +x t/t9999-psuh-tutorial.sh
> +----

I never "create an empty file" before editing in real life. Is this a common workflow in some circles?

I'd be tempted to suggest s/touch/edit/ here, but I dunno.
> +https://public-inbox.org/git/foo.12345.author@example.com/other/junk
> +----
> +
> +Your Message-Id is `foo.12345.author@example.com`. This example will be used

Technically, <foo.12345.author@example.com> with angle bracket is the message Id, but the tool is lenient to allow this common mistake ;-) so this one, and the "send-email --in-reply-to=" example below can stay as-is.

Show 17 quoted lines
> +below as well; make sure to replace it with the correct Message-Id for your
> +**previous cover letter** - that is, if you're sending v2, use the Message-Id
> +from v1; if you're sending v3, use the Message-Id from v2.
> +
> +Now send the emails again, paying close attention to which messages you pass in
> +to the command:
> +
> +----
> +$ git send-email --to=target@example.com
> +		 --in-reply-to=foo.12345.author@example.com
> +----
> +
> +=== Bonus Chapter: One-Patch Changes
> +
> +In some cases, your very small change may consist of only one patch. When that
> +happens, you only need to send one email. Your commit message should already be
> +verbose, but if you need to supply even more context, you can do so below the

s|be verbose|explain what and why of the change well| or something like that?

> +`---` in your patch. Take the example below, generated with `git format-patch`
> +on a single commit:
Previous: Emily ShafferNext: Emily Shaffer
Message 18 of 44 in “documentation: add lab for first contribution”
  1. 0/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 11, 2019
  2. 1/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 11, 2019
  3. Junio C HamanoApr 12, 2019
  4. Emily ShafferApr 12, 2019
  5. Junio C HamanoApr 13, 2019
  6. Emily ShafferApr 15, 2019
  7. Josh SteadmonApr 11, 2019
  8. Junio C HamanoApr 12, 2019
  9. Emily ShafferApr 12, 2019
  10. 0/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 16, 2019
  11. 1/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 16, 2019
  12. Junio C HamanoApr 17, 2019
  13. Eric SunshineApr 17, 2019
  14. Junio C HamanoApr 18, 2019
  15. Emily ShafferApr 17, 2019
  16. Emily ShafferApr 16, 2019
  17. documentation: add lab for first contributionEmily Shaffer, Apr 19, 2019
  18. Junio C HamanoApr 21, 2019
  19. Emily ShafferApr 22, 2019
  20. documentation: add tutorial for first contributionEmily Shaffer, Apr 23, 2019
  21. Josh SteadmonApr 30, 2019
  22. Emily ShafferMay 2, 2019
  23. Phil HordMay 3, 2019
  24. Emily ShafferMay 7, 2019
  25. Jonathan TanMay 6, 2019
  26. Emily ShafferMay 7, 2019
  27. Jonathan TanMay 7, 2019
  28. Junio C HamanoMay 8, 2019
  29. 0/2 documentation: add lab for first contributionEmily Shaffer, May 7, 2019
  30. 1/2 documentation: add tutorial for first contributionEmily Shaffer, May 7, 2019
  31. Emily ShafferMay 7, 2019
  32. Junio C HamanoMay 8, 2019
  33. Emily ShafferMay 8, 2019
  34. Jonathan TanMay 8, 2019
  35. 2/2 documentation: add anchors to MyFirstContributionEmily Shaffer, May 7, 2019
  36. Junio C HamanoMay 8, 2019
  37. 0/2 documentation: add tutorial for first contributionEmily Shaffer, May 17, 2019
  38. 1/2 documentation: add tutorial for first contributionEmily Shaffer, May 17, 2019
  39. Christian CouderMay 26, 2019
  40. Emily ShafferMay 29, 2019
  41. SZEDER GáborOct 18, 2019
  42. Emily ShafferOct 18, 2019
  43. 2/2 documentation: add anchors to MyFirstContributionEmily Shaffer, May 17, 2019
  44. doc: add some nit fixes to MyFirstContributionEmily Shaffer, May 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.