{"thread":{"id":"56757","subject":"[PATCH] MyFirstContribution: teach to use \"format-patch --base=auto\"","startedAt":"2021-10-22T06:42:13Z","lastAt":"2021-10-23T21:03:38Z","messageCount":4,"participants":["Bagas Sanjaya","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"439342","messageId":"20211022064044.28761-1-bagasdotme@gmail.com","threadId":"56757","inReplyTo":null,"subject":"[PATCH] MyFirstContribution: teach to use \"format-patch --base=auto\"","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-10-22T06:40:46Z","receivedAt":"2021-10-22T06:42:13Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"From: Junio C Hamano <gitster@pobox.com>\n\nLet's encourage first-time contributors to tell us what commit they\nbased their work with the format-patch invocation. As the example\nalready forks from origin/master and branch.autosetupmerge by\ndefault records the upstream when the psuh branch was created, we\ncan use --base=auto for this.  Also, mention to the readers that the\nrange of commits can simply be given with `@{u}` if they are on the\n`psuh` branch already.\n\nAs we are getting one more option on the command line, and spending\none paragraph each to explain them, let's reformat that part of the\ndescription as a bulletted list.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n[Bagas Sanjaya: fix grammar in commit message and explain `auto` value]\nSigned-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n---\n Documentation/MyFirstContribution.txt | 41 ++++++++++++++++++---------\n 1 file changed, 28 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt\nindex b20bc8e914..b896d10755 100644\n--- a/Documentation/MyFirstContribution.txt\n+++ b/Documentation/MyFirstContribution.txt\n@@ -905,19 +905,34 @@ Sending emails with Git is a two-part process; before you can prepare the emails\n themselves, you'll need to prepare the patches. Luckily, this is pretty simple:\n \n ----\n-$ git format-patch --cover-letter -o psuh/ master..psuh\n-----\n-\n-The `--cover-letter` parameter tells `format-patch` to create a cover letter\n-template for you. You will need to fill in the template before you're ready\n-to send - but for now, the template will be next to your other patches.\n-\n-The `-o psuh/` parameter tells `format-patch` to place the patch files into a\n-directory. This is useful because `git send-email` can take a directory and\n-send out all the patches from there.\n-\n-`master..psuh` tells `format-patch` to generate patches for the difference\n-between `master` and `psuh`. It will make one patch file per commit. After you\n+$ git format-patch --cover-letter -o psuh/ --base=auto psuh@{u}..psuh\n+----\n+\n+ . The `--cover-letter` option tells `format-patch` to create a\n+   cover letter template for you. You will need to fill in the\n+   template before you're ready to send - but for now, the template\n+   will be next to your other patches.\n+\n+ . The `-o psuh/` option tells `format-patch` to place the patch\n+   files into a directory. This is useful because `git send-email`\n+   can take a directory and send out all the patches from there.\n+\n+ . The `--base=auto` option tells the command to record the \"base\n+   commit\", on which the recipient is expected to apply the patch\n+   series. The `auto` value will cause `format-patch` to track\n+   the base commit automatically, which is the merge base of tip\n+   commit of the remote-tracking branch and the specified\n+   revision range.\n+\n+ . The `psuh@{u}..psuh` option tells `format-patch` to generate\n+   patches for the commits you created on the `psuh` branch since it\n+   forked from its upstream (which is `origin/master` if you\n+   followed the example in the \"Set up your workspace\" section).  If\n+   you are already on the `psuh` branch, you can just say `@{u}`,\n+   which means \"commits on the current branch since it forked from\n+   its upstream\", which is the same thing.\n+\n+The command will make one patch file per commit. After you\n run, you can go have a look at each of the patches with your favorite text\n editor and make sure everything looks alright; however, it's not recommended to\n make code fixups via the patch file. It's a better idea to make the change the\n\nbase-commit: f443b226ca681d87a3a31e245a70e6bc2769123c\n-- \nAn old man doll... just what I always wanted! - Clara\n\n"},{"id":"439344","messageId":"CAPig+cSgEvxVBUhrVf9ceG5L1DU5qTbfOgo=wOsOja1X8y+pfg@mail.gmail.com","threadId":"56757","inReplyTo":"20211022064044.28761-1-bagasdotme@gmail.com","subject":"Re: [PATCH] MyFirstContribution: teach to use \"format-patch --base=auto\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2021-10-22T06:48:02Z","receivedAt":"2021-10-22T06:48:16Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Oct 22, 2021 at 2:43 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n> From: Junio C Hamano <gitster@pobox.com>\n>\n> Let's encourage first-time contributors to tell us what commit they\n> based their work with the format-patch invocation. As the example\n> already forks from origin/master and branch.autosetupmerge by\n> default records the upstream when the psuh branch was created, we\n> can use --base=auto for this.  Also, mention to the readers that the\n> range of commits can simply be given with `@{u}` if they are on the\n> `psuh` branch already.\n>\n> As we are getting one more option on the command line, and spending\n> one paragraph each to explain them, let's reformat that part of the\n> description as a bulletted list.\n\ns/bulletted/bulleted/\n\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> [Bagas Sanjaya: fix grammar in commit message and explain `auto` value]\n> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n"},{"id":"439457","messageId":"xmqqlf2jbglu.fsf@gitster.g","threadId":"56757","inReplyTo":"20211022064044.28761-1-bagasdotme@gmail.com","subject":"Re: [PATCH] MyFirstContribution: teach to use \"format-patch --base=auto\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-23T21:01:33Z","receivedAt":"2021-10-23T21:01:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> From: Junio C Hamano <gitster@pobox.com>\n>\n> Let's encourage first-time contributors to tell us what commit they\n> based their work with the format-patch invocation. As the example\n> already forks from origin/master and branch.autosetupmerge by\n> default records the upstream when the psuh branch was created, we\n> can use --base=auto for this.  Also, mention to the readers that the\n> range of commits can simply be given with `@{u}` if they are on the\n> `psuh` branch already.\n>\n> As we are getting one more option on the command line, and spending\n> one paragraph each to explain them, let's reformat that part of the\n> description as a bulletted list.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> [Bagas Sanjaya: fix grammar in commit message and explain `auto` value]\n> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n\n\nHmph, the log message changes, relative to what is queued, look like\nso:\n\n    Let's encourage first-time contributors to tell us what commit they\n    based their work[-on-] with the format-patch invocation. As the example\n    already forks from origin/master and branch.autosetupmerge by\n    default records the upstream when the psuh branch was created, we\n    can use --base=auto for this.  Also, mention {+to the readers+} that\n    the range of commits can simply be given with `@{u}` if they are on the\n    `psuh` branch already.\n\n    As we are getting one more option on the command line, and spending\n    one paragraph each to explain them, let's reformat that part of the\n    description as a bulletted list.\n\nContributors will tell us what commit they based their work on, and\nremoval of \"on\" does not look like fixing grammar to me (it looks\nmore like breaking).  Adding \"to the readers\" is not _wrong_ per-se,\nbut given that everything you write in the documentation is telling\nto the readers and to nobody else, it does not seem to add anything.\nIt is something different from \"fix grammar\".\n\nIn short, I do not think anything needs to be changed in the\nproposed log message in the version that has been queued.\n\n> + . The `--base=auto` option tells the command to record the \"base\n> +   commit\", on which the recipient is expected to apply the patch\n> +   series. The `auto` value will cause `format-patch` to track\n> +   the base commit automatically, which is the merge base of tip\n> +   commit of the remote-tracking branch and the specified\n> +   revision range.\n\nEverything after \"The `auto` value will...\" is new and is a welcome\naddition, as I agree that giving a brief explanation of the option\nis a good idea.  Thanks for highlighting the careless addition I\nmade in the original version.\n\nBut use of verb \"track\" in the format-patch documentation that was\ncopied to this patch should be fixed first.  format-patch does not\nchange any history and it does not track anything.  Perhaps \"track\"\n-> \"compute\", e.g.\n\n    The `auto` value will cause `format-patch` to compute the base\n    commit automatically, which is the merge base of tip commit of the\n    remote-tracking branch and the specified revision range.\n\nAnd the matching correction to the existing documentation should\nlook like the attached patch.\n\nThanks.\n\n----- >8 --------- >8 --------- >8 --------- >8 --------- >8 ----\nSubject: [PATCH] format-patch (doc): clarify --base=auto\n\nWhat --base=auto tells format-patch is to compute the base commit\nitself, using the tracking information.  It does not make anything\ntrack anything.\n\nTighten the phrasing so that it won't be copied and pasted to other\nplaces.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-format-patch.txt | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git c/Documentation/git-format-patch.txt w/Documentation/git-format-patch.txt\nindex fe2f69d36e..113eabc107 100644\n--- c/Documentation/git-format-patch.txt\n+++ w/Documentation/git-format-patch.txt\n@@ -689,10 +689,10 @@ You can also use `git format-patch --base=P -3 C` to generate patches\n for A, B and C, and the identifiers for P, X, Y, Z are appended at the\n end of the first message.\n \n-If set `--base=auto` in cmdline, it will track base commit automatically,\n-the base commit will be the merge base of tip commit of the remote-tracking\n+If set `--base=auto` in cmdline, it will automatically compute\n+the base commit as the merge base of tip commit of the remote-tracking\n branch and revision-range specified in cmdline.\n-For a local branch, you need to track a remote branch by `git branch\n+For a local branch, you need to make it to track a remote branch by `git branch\n --set-upstream-to` before using this option.\n \n EXAMPLES\n\n"},{"id":"439458","messageId":"xmqqh7d7bgig.fsf@gitster.g","threadId":"56757","inReplyTo":"CAPig+cSgEvxVBUhrVf9ceG5L1DU5qTbfOgo=wOsOja1X8y+pfg@mail.gmail.com","subject":"Re: [PATCH] MyFirstContribution: teach to use \"format-patch --base=auto\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-23T21:03:35Z","receivedAt":"2021-10-23T21:03:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Fri, Oct 22, 2021 at 2:43 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:\n>> From: Junio C Hamano <gitster@pobox.com>\n>>\n>> Let's encourage first-time contributors to tell us what commit they\n>> based their work with the format-patch invocation. As the example\n>> already forks from origin/master and branch.autosetupmerge by\n>> default records the upstream when the psuh branch was created, we\n>> can use --base=auto for this.  Also, mention to the readers that the\n>> range of commits can simply be given with `@{u}` if they are on the\n>> `psuh` branch already.\n>>\n>> As we are getting one more option on the command line, and spending\n>> one paragraph each to explain them, let's reformat that part of the\n>> description as a bulletted list.\n>\n> s/bulletted/bulleted/\n\nThanks; will fix locally.\n"}]}