git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset
@ 2021-10-15 12:25 Bagas Sanjaya
  2021-10-15 17:06 ` Glen Choo
  2021-10-15 17:14 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Bagas Sanjaya @ 2021-10-15 12:25 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Glen Choo, Carlo Arenas, Bagas Sanjaya

Specifying base point (commit hash) can help reviewers and testers
interested on the patchset. Mention how to record it with `--base`
option to `format-patch`.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Changes since v1 [1]:
     - Rewording (suggested by Junio).
     - Show command to determine base commit hash and pass it to `--base`
       option.

 [1]:
https://lore.kernel.org/git/f25fae40-0313-287b-5482-1c64cbe8cb64@gmail.com/T/#t

 Documentation/MyFirstContribution.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index b20bc8e914..5aaf31cb66 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -937,6 +937,23 @@ but want reviewers to look at what they have so far. You can add this flag with
 Check and make sure that your patches and cover letter template exist in the
 directory you specified - you're nearly ready to send out your review!
 
+It would help those who review and test your patches to specify on what
+commit the patches should be applied to. To do so, use the `--base` option
+when running `format-patch`. The option expects hash of the commit the
+patchset is based on. Since we base `psuh` on top of `master`, the base
+commit hash can be determined by: 
+
+----
+$ git show -s --format="%H" master
+----
+
+The output of command above can be passed to `--base` option. Replace `<base>`
+with your own hash:
+
+----
+$ git format-patch --cover-letter --base=<base> -o psuh/ master..psuh
+----
+
 [[cover-letter]]
 === Preparing Email
 

base-commit: 2bd2f258f4195ac54293a3f45b86457c0bd5fc11
-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset
  2021-10-15 12:25 [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset Bagas Sanjaya
@ 2021-10-15 17:06 ` Glen Choo
  2021-10-16  5:16   ` Bagas Sanjaya
  2021-10-15 17:14 ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Glen Choo @ 2021-10-15 17:06 UTC (permalink / raw)
  To: Bagas Sanjaya, git; +Cc: Junio C Hamano, Carlo Arenas, Bagas Sanjaya

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
> index b20bc8e914..5aaf31cb66 100644
> --- a/Documentation/MyFirstContribution.txt
> +++ b/Documentation/MyFirstContribution.txt
> @@ -937,6 +937,23 @@ but want reviewers to look at what they have so far. You can add this flag with
>  Check and make sure that your patches and cover letter template exist in the
>  directory you specified - you're nearly ready to send out your review!
>  
> +It would help those who review and test your patches to specify on what
> +commit the patches should be applied to. To do so, use the `--base` option
> +when running `format-patch`. The option expects hash of the commit the
> +patchset is based on. Since we base `psuh` on top of `master`, the base
> +commit hash can be determined by: 
> +
> +----
> +$ git show -s --format="%H" master
> +----
> +
> +The output of command above can be passed to `--base` option. Replace `<base>`
> +with your own hash:
> +
> +----
> +$ git format-patch --cover-letter --base=<base> -o psuh/ master..psuh
> +----
> +
>  [[cover-letter]]
>  === Preparing Email

This reads quite awkwardly because a few lines above, we already tell
the reader exactly what commands to run:

  Sending emails with Git is a two-part process; before you can prepare the emails
  themselves, you'll need to prepare the patches. Luckily, this is pretty simple:

  ----
  $ git format-patch --cover-letter -o psuh/ master..psuh
  ----

If we do accept this suggestion (and I am not sure if we should, because
as Junio said, there are strong conventions for determining the branch
point), I think this would be easier to follow if we incorporate it into
the existing instructions. Something like..

  Sending emails with Git is a two-part process; before you can prepare the emails
  themselves, you'll need to prepare the patches. Luckily, this is
  pretty simple. First, we'll get the hash of the commit the patchset is
  based on. We call this commit the 'base'.

  ----
  $ git show -s --format="%H" master
  ----

  Now, we'll generate the patches, passing the hash of the 'base' to the
  --base option.

  ----
  $ git format-patch --cover-letter --base=<base> -o psuh/ master..psuh
  ----

  [...describe --base=<base> the way we describe the other options].

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset
  2021-10-15 12:25 [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset Bagas Sanjaya
  2021-10-15 17:06 ` Glen Choo
@ 2021-10-15 17:14 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2021-10-15 17:14 UTC (permalink / raw)
  To: Bagas Sanjaya; +Cc: git, Glen Choo, Carlo Arenas

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> +It would help those who review and test your patches to specify on what
> +commit the patches should be applied to. To do so, use the `--base` option
> +when running `format-patch`. The option expects hash of the commit the
> +patchset is based on. Since we base `psuh` on top of `master`, the base
> +commit hash can be determined by: 
> +
> +----
> +$ git show -s --format="%H" master
> +----

That's a littie bit wasteful.

If we need to teach more stuff (like --format="%H"), one thing that
more directly help this exact use case is to teach

    git merge-base master psuh

here.  But read on.

> +The output of command above can be passed to `--base` option. Replace `<base>`
> +with your own hash:
> +
> +----
> +$ git format-patch --cover-letter --base=<base> -o psuh/ master..psuh
> +----
> +

If we set up the psuh branch correctly, we can use the `--base=auto`
option, which would reduce the number of things readers need to
learn by one.  Then the whole example in this patch can be reduced
to (after dropping "Since we base `psuh` on top of `master`..." at
the end of the previous paragraph):

    patchset is based on.  As we forked `psuh` to build on
    `origin/master`, we can use the `--base=auto` option when
    running the `format-patch` command, like so:

    ----
    $ git format-patch --cover-letter --base=auto -o psuh/ origin/master..psuh
    ----

That is one fewer step the user needs to execute.

This needs one line change in the earlier part of the document (not
touched by the patch under discussion here). 

In the [[setup-workspace]] section, we create the psuh by branching
out of the origin/master (not 'master', so the references to
`master` in the patch under discussion need to be updated, which I
did in the above paragraph already), like so:

    ----
    $ git checkout -b psuh origin/master
    ----

All we need to do is to pass the `-t` option there, i.e.

    ----
    $ git checkout -t -b psuh origin/master
    ----
    
to make the --base=auto work, I think.

Thanks.


[Addendum]

Also, if the tutorial text naturally guides the user to be "on" the
`psuh` branch when the patches are taken from it, we could even
shorten the command to

    ----
    $ git format-patch --cover-letter --base=auto -o psuh/ @{u}..
    ----

That extra shortening would need a bit more work in the earlier part
of [[format-patch]] section around the part that says "Luckily, this
is pretty simple".  Basically, we need to invent a plausible story
for the user to have done "git checkout psuh" earlier, so that it is
clear to the readers that the `psuh` branch is the current branch.

So it probably is a good idea to leave it outside the scope of this
topic.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset
  2021-10-15 17:06 ` Glen Choo
@ 2021-10-16  5:16   ` Bagas Sanjaya
  0 siblings, 0 replies; 4+ messages in thread
From: Bagas Sanjaya @ 2021-10-16  5:16 UTC (permalink / raw)
  To: Glen Choo, git; +Cc: Junio C Hamano, Carlo Arenas

On 16/10/21 00.06, Glen Choo wrote:
> This reads quite awkwardly because a few lines above, we already tell
> the reader exactly what commands to run:
> 
>    Sending emails with Git is a two-part process; before you can prepare the emails
>    themselves, you'll need to prepare the patches. Luckily, this is pretty simple:
> 
>    ----
>    $ git format-patch --cover-letter -o psuh/ master..psuh
>    ----
> 
> If we do accept this suggestion (and I am not sure if we should, because
> as Junio said, there are strong conventions for determining the branch
> point), I think this would be easier to follow if we incorporate it into
> the existing instructions. Something like..
> 
>    Sending emails with Git is a two-part process; before you can prepare the emails
>    themselves, you'll need to prepare the patches. Luckily, this is
>    pretty simple. First, we'll get the hash of the commit the patchset is
>    based on. We call this commit the 'base'.
> 
>    ----
>    $ git show -s --format="%H" master
>    ----
> 
>    Now, we'll generate the patches, passing the hash of the 'base' to the
>    --base option.
> 
>    ----
>    $ git format-patch --cover-letter --base=<base> -o psuh/ master..psuh
>    ----
> 
>    [...describe --base=<base> the way we describe the other options].
> 

Actually it is up to contributors whether they want to include `--base` 
or not.

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-16  5:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 12:25 [PATCH v2] Documentation: specify base point when generating MyFirstContribution patchset Bagas Sanjaya
2021-10-15 17:06 ` Glen Choo
2021-10-16  5:16   ` Bagas Sanjaya
2021-10-15 17:14 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).