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

Re: [PATCH] MyFirstContribution: teach to use "format-patch --base=auto"

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2021, 21:01 UTC
Message-ID
<xmqqlf2jbglu.fsf@gitster.g>
In-Reply-To
<20211022064044.28761-1-bagasdotme@gmail.com>
Bagas Sanjaya <bagasdotme@gmail.com> writes:
Show 17 quoted lines
> 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.

Show 6 quoted lines
> + . 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
Previous: Junio C Hamano
Message 4 of 4 in “MyFirstContribution: teach to use "format-patch --base=auto"”
  1. MyFirstContribution: teach to use "format-patch --base=auto"Bagas Sanjaya, Oct 22, 2021
  2. Eric SunshineOct 22, 2021
  3. Junio C HamanoOct 23, 2021
  4. Junio C HamanoOct 23, 2021

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.