git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] MyFirstContribution: teach to use "format-patch --base=auto"
@ 2021-10-22  6:40 Bagas Sanjaya
  2021-10-22  6:48 ` Eric Sunshine
  2021-10-23 21:01 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Bagas Sanjaya @ 2021-10-22  6:40 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Glen Choo, Bagas Sanjaya

From: Junio C Hamano <gitster@pobox.com>

Let's encourage first-time contributors to tell us what commit they
based their work with the format-patch invocation. As the example
already forks from origin/master and branch.autosetupmerge by
default records the upstream when the psuh branch was created, we
can use --base=auto for this.  Also, mention to the readers that the
range of commits can simply be given with `@{u}` if they are on the
`psuh` branch already.

As we are getting one more option on the command line, and spending
one paragraph each to explain them, let's reformat that part of the
description as a bulletted list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
[Bagas Sanjaya: fix grammar in commit message and explain `auto` value]
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/MyFirstContribution.txt | 41 ++++++++++++++++++---------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index b20bc8e914..b896d10755 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -905,19 +905,34 @@ 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
-----
-
-The `--cover-letter` parameter tells `format-patch` to create a cover letter
-template for you. You will need to fill in the template before you're ready
-to send - but for now, the template will be next to your other patches.
-
-The `-o psuh/` parameter tells `format-patch` to place the patch files into a
-directory. This is useful because `git send-email` can take a directory and
-send out all the patches from there.
-
-`master..psuh` tells `format-patch` to generate patches for the difference
-between `master` and `psuh`. It will make one patch file per commit. After you
+$ git format-patch --cover-letter -o psuh/ --base=auto psuh@{u}..psuh
+----
+
+ . The `--cover-letter` option tells `format-patch` to create a
+   cover letter template for you. You will need to fill in the
+   template before you're ready to send - but for now, the template
+   will be next to your other patches.
+
+ . The `-o psuh/` option tells `format-patch` to place the patch
+   files into a directory. This is useful because `git send-email`
+   can take a directory and send out all the patches from there.
+
+ . The `--base=auto` option tells the command to record the "base
+   commit", on which the recipient is expected to apply the patch
+   series. The `auto` value will cause `format-patch` to track
+   the base commit automatically, which is the merge base of tip
+   commit of the remote-tracking branch and the specified
+   revision range.
+
+ . The `psuh@{u}..psuh` option tells `format-patch` to generate
+   patches for the commits you created on the `psuh` branch since it
+   forked from its upstream (which is `origin/master` if you
+   followed the example in the "Set up your workspace" section).  If
+   you are already on the `psuh` branch, you can just say `@{u}`,
+   which means "commits on the current branch since it forked from
+   its upstream", which is the same thing.
+
+The command will make one patch file per commit. After you
 run, you can go have a look at each of the patches with your favorite text
 editor and make sure everything looks alright; however, it's not recommended to
 make code fixups via the patch file. It's a better idea to make the change the

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


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

* Re: [PATCH] MyFirstContribution: teach to use "format-patch --base=auto"
  2021-10-22  6:40 [PATCH] MyFirstContribution: teach to use "format-patch --base=auto" Bagas Sanjaya
@ 2021-10-22  6:48 ` Eric Sunshine
  2021-10-23 21:03   ` Junio C Hamano
  2021-10-23 21:01 ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sunshine @ 2021-10-22  6:48 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Git List, Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Glen Choo

On Fri, Oct 22, 2021 at 2:43 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> From: Junio C Hamano <gitster@pobox.com>
>
> Let's encourage first-time contributors to tell us what commit they
> based their work with the format-patch invocation. As the example
> already forks from origin/master and branch.autosetupmerge by
> default records the upstream when the psuh branch was created, we
> can use --base=auto for this.  Also, mention to the readers that the
> range of commits can simply be given with `@{u}` if they are on the
> `psuh` branch already.
>
> As we are getting one more option on the command line, and spending
> one paragraph each to explain them, let's reformat that part of the
> description as a bulletted list.

s/bulletted/bulleted/

> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> [Bagas Sanjaya: fix grammar in commit message and explain `auto` value]
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>

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

* Re: [PATCH] MyFirstContribution: teach to use "format-patch --base=auto"
  2021-10-22  6:40 [PATCH] MyFirstContribution: teach to use "format-patch --base=auto" Bagas Sanjaya
  2021-10-22  6:48 ` Eric Sunshine
@ 2021-10-23 21:01 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2021-10-23 21:01 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: git, Eric Sunshine, Ævar Arnfjörð Bjarmason,
	Glen Choo

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> From: Junio C Hamano <gitster@pobox.com>
>
> Let's encourage first-time contributors to tell us what commit they
> based their work with the format-patch invocation. As the example
> already forks from origin/master and branch.autosetupmerge by
> default records the upstream when the psuh branch was created, we
> can use --base=auto for this.  Also, mention to the readers that the
> range of commits can simply be given with `@{u}` if they are on the
> `psuh` branch already.
>
> As we are getting one more option on the command line, and spending
> one paragraph each to explain them, let's reformat that part of the
> description as a bulletted list.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> [Bagas Sanjaya: fix grammar in commit message and explain `auto` value]
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>


Hmph, the log message changes, relative to what is queued, look like
so:

    Let's encourage first-time contributors to tell us what commit they
    based their work[-on-] with the format-patch invocation. As the example
    already forks from origin/master and branch.autosetupmerge by
    default records the upstream when the psuh branch was created, we
    can use --base=auto for this.  Also, mention {+to the readers+} that
    the range of commits can simply be given with `@{u}` if they are on the
    `psuh` branch already.

    As we are getting one more option on the command line, and spending
    one paragraph each to explain them, let's reformat that part of the
    description as a bulletted list.

Contributors will tell us what commit they based their work on, and
removal of "on" does not look like fixing grammar to me (it looks
more like breaking).  Adding "to the readers" is not _wrong_ per-se,
but given that everything you write in the documentation is telling
to the readers and to nobody else, it does not seem to add anything.
It is something different from "fix grammar".

In short, I do not think anything needs to be changed in the
proposed log message in the version that has been queued.

> + . The `--base=auto` option tells the command to record the "base
> +   commit", on which the recipient is expected to apply the patch
> +   series. The `auto` value will cause `format-patch` to track
> +   the base commit automatically, which is the merge base of tip
> +   commit of the remote-tracking branch and the specified
> +   revision range.

Everything after "The `auto` value will..." is new and is a welcome
addition, as I agree that giving a brief explanation of the option
is a good idea.  Thanks for highlighting the careless addition I
made in the original version.

But use of verb "track" in the format-patch documentation that was
copied to this patch should be fixed first.  format-patch does not
change any history and it does not track anything.  Perhaps "track"
-> "compute", e.g.

    The `auto` value will cause `format-patch` to compute the base
    commit automatically, which is the merge base of tip commit of the
    remote-tracking branch and the specified revision range.

And the matching correction to the existing documentation should
look like the attached patch.

Thanks.

----- >8 --------- >8 --------- >8 --------- >8 --------- >8 ----
Subject: [PATCH] format-patch (doc): clarify --base=auto

What --base=auto tells format-patch is to compute the base commit
itself, using the tracking information.  It does not make anything
track anything.

Tighten the phrasing so that it won't be copied and pasted to other
places.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-format-patch.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git c/Documentation/git-format-patch.txt w/Documentation/git-format-patch.txt
index fe2f69d36e..113eabc107 100644
--- c/Documentation/git-format-patch.txt
+++ w/Documentation/git-format-patch.txt
@@ -689,10 +689,10 @@ You can also use `git format-patch --base=P -3 C` to generate patches
 for A, B and C, and the identifiers for P, X, Y, Z are appended at the
 end of the first message.
 
-If set `--base=auto` in cmdline, it will track base commit automatically,
-the base commit will be the merge base of tip commit of the remote-tracking
+If set `--base=auto` in cmdline, it will automatically compute
+the base commit as the merge base of tip commit of the remote-tracking
 branch and revision-range specified in cmdline.
-For a local branch, you need to track a remote branch by `git branch
+For a local branch, you need to make it to track a remote branch by `git branch
 --set-upstream-to` before using this option.
 
 EXAMPLES


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

* Re: [PATCH] MyFirstContribution: teach to use "format-patch --base=auto"
  2021-10-22  6:48 ` Eric Sunshine
@ 2021-10-23 21:03   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2021-10-23 21:03 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Bagas Sanjaya, Git List, Ævar Arnfjörð Bjarmason,
	Glen Choo

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Fri, Oct 22, 2021 at 2:43 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>> From: Junio C Hamano <gitster@pobox.com>
>>
>> Let's encourage first-time contributors to tell us what commit they
>> based their work with the format-patch invocation. As the example
>> already forks from origin/master and branch.autosetupmerge by
>> default records the upstream when the psuh branch was created, we
>> can use --base=auto for this.  Also, mention to the readers that the
>> range of commits can simply be given with `@{u}` if they are on the
>> `psuh` branch already.
>>
>> As we are getting one more option on the command line, and spending
>> one paragraph each to explain them, let's reformat that part of the
>> description as a bulletted list.
>
> s/bulletted/bulleted/

Thanks; will fix locally.

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

end of thread, other threads:[~2021-10-23 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  6:40 [PATCH] MyFirstContribution: teach to use "format-patch --base=auto" Bagas Sanjaya
2021-10-22  6:48 ` Eric Sunshine
2021-10-23 21:03   ` Junio C Hamano
2021-10-23 21:01 ` 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).