{"thread":{"id":"62267","subject":"[PATCH 0/3] doc: merge-tree: improve the script example","startedAt":"2024-10-07T11:11:13Z","lastAt":"2024-10-10T00:01:56Z","messageCount":27,"participants":["Kristoffer Haugsbakk","Phillip Wood","Elijah Newren","Junio C Hamano","Andreas Schwab"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"504311","messageId":"cover.1728298931.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":null,"subject":"[PATCH 0/3] doc: merge-tree: improve the script example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-07T11:10:26Z","receivedAt":"2024-10-07T11:11:13Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n\n\nKristoffer Haugsbakk (3):\n  doc: merge-tree: provide a commit message\n  doc: merge-tree: use lower-case variables\n  doc: merge-tree: use || directly\n\n Documentation/git-merge-tree.txt | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)\n\n--\n2.46.1.641.g54e7913fcb6\n"},{"id":"504312","messageId":"fef203471f4492af1468a0c91088324c394effd5.1728298931.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728298931.git.code@khaugsbakk.name","subject":"[PATCH 1/3] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-07T11:10:27Z","receivedAt":"2024-10-07T11:11:22Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n\nFrom: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nProvide a commit message in the example command.\n\nThe command will hang since it is waiting for a commit message on\nstdin.  Which is usable but not straightforward enough since this is\nexample code.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    Unlike on some other manuals you probably won’t end up running these\n    commands directly to test things out.  But you might end up copying and\n    modifying it when playing around with the command.\n\n Documentation/git-merge-tree.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 84cb2edf6d0..590cbf5df79 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -213,7 +213,7 @@ used as a part of a series of steps such as:\n \n        NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n        test $? -eq 0 || die \"There were conflicts...\"\n-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n+       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n        git update-ref $BRANCH1 $NEWCOMMIT\n \n Note that when the exit status is non-zero, `NEWTREE` in this sequence\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504313","messageId":"97f16cb68e059792ddc7d1897ab6e93d536fe19c.1728298931.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728298931.git.code@khaugsbakk.name","subject":"[PATCH 2/3] doc: merge-tree: use lower-case variables","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-07T11:10:28Z","receivedAt":"2024-10-07T11:11:36Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n\nFrom: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nThis is easier to read.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-merge-tree.txt | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 590cbf5df79..10f8ac7f80a 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,12 +211,12 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n-       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n+       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n        test $? -eq 0 || die \"There were conflicts...\"\n-       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n-       git update-ref $BRANCH1 $NEWCOMMIT\n+       newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n+       git update-ref $branch1 $newcommit\n \n-Note that when the exit status is non-zero, `NEWTREE` in this sequence\n+Note that when the exit status is non-zero, `newtree` in this sequence\n will contain a lot more output than just a tree.\n \n For conflicts, the output includes the same information that you'd get\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504314","messageId":"4057d6386125e51fd934f92abd11c62a9d24a832.1728298931.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728298931.git.code@khaugsbakk.name","subject":"[PATCH 3/3] doc: merge-tree: use || directly","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-07T11:10:29Z","receivedAt":"2024-10-07T11:11:45Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n\nFrom: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nUse `||` directly since that is more straightforward than checking the\nlast exit status.\n\nAlso use `echo` and `exit` since `die` is not defined.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-merge-tree.txt | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 10f8ac7f80a..46091da022d 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,8 +211,10 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n-       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n-       test $? -eq 0 || die \"There were conflicts...\"\n+       newtree=$(git merge-tree --write-tree $branch1 $branch2) || {\n+           echo \"There were conflicts...\" 1>&2\n+           exit 1\n+       }\n        newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n        git update-ref $branch1 $newcommit\n \n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504321","messageId":"b41ce281-d3b8-43c3-8b27-f5dc59601ca7@app.fastmail.com","threadId":"62267","inReplyTo":"fef203471f4492af1468a0c91088324c394effd5.1728298931.git.code@khaugsbakk.name","subject":"Re: [PATCH 1/3] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-07T12:02:34Z","receivedAt":"2024-10-07T12:02:55Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Mon, Oct 7, 2024, at 13:10, Kristoffer Haugsbakk wrote:\n> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n>\n> From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nI think these got double upped since I used `--from` in format-patch.\nThen I used send-email.  format-patch warns against that:\n\n  “ Note that this option is only useful if you are actually sending the\n    emails and want to identify yourself as the sender, but\n    retain the original author (and git am will correctly pick up\n    the in-body header). Note also that git send-email already\n    handles this transformation for you, and this option should\n    not be used if you are feeding the result to git send-email.\n\nSo under the normal use I guess:\n\n• You have someone else’s patches\n• send-email sees that you are not that person (because of your config)\n• It puts the From in the message body (it just works)\n\nBut that wasn’t the case for me since my ident is still the same as the\nauthor.\n\nThat went over my head before I sent.\n\n-- \nKristoffer Haugsbakk\n\n\n"},{"id":"504329","messageId":"d18f6fdf-d0ba-40e1-a2b9-2fecfbdadde4@gmail.com","threadId":"62267","inReplyTo":"97f16cb68e059792ddc7d1897ab6e93d536fe19c.1728298931.git.code@khaugsbakk.name","subject":"Re: [PATCH 2/3] doc: merge-tree: use lower-case variables","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-10-07T14:58:55Z","receivedAt":"2024-10-07T14:58:59Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Kristoffer\n\nOn 07/10/2024 12:10, Kristoffer Haugsbakk wrote:\n> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n> \n> From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> \n> This is easier to read.\n\nI think that is a matter of taste, one could argue that using uppercase \nvariable names makes them stand out so the user can see which arguments \nare parameters more clearly.\n\nBest Wishes\n\nPhillip\n\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n>   Documentation/git-merge-tree.txt | 8 ++++----\n>   1 file changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\n> index 590cbf5df79..10f8ac7f80a 100644\n> --- a/Documentation/git-merge-tree.txt\n> +++ b/Documentation/git-merge-tree.txt\n> @@ -211,12 +211,12 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n>   linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n>   used as a part of a series of steps such as:\n>   \n> -       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n> +       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n>          test $? -eq 0 || die \"There were conflicts...\"\n> -       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n> -       git update-ref $BRANCH1 $NEWCOMMIT\n> +       newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n> +       git update-ref $branch1 $newcommit\n>   \n> -Note that when the exit status is non-zero, `NEWTREE` in this sequence\n> +Note that when the exit status is non-zero, `newtree` in this sequence\n>   will contain a lot more output than just a tree.\n>   \n>   For conflicts, the output includes the same information that you'd get\n\n"},{"id":"504330","messageId":"3ce39bec-24e4-4850-b947-e6476fac5132@gmail.com","threadId":"62267","inReplyTo":"cover.1728298931.git.code@khaugsbakk.name","subject":"Re: [PATCH 0/3] doc: merge-tree: improve the script example","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-10-07T14:59:04Z","receivedAt":"2024-10-07T14:59:07Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Kristoffer\n\nThanks for working on this. Patches 1 and 3 look like clear improvements \nto me, I've left a comment on patch 2 as the improvement is less clear \nto me but I wouldn't object to it being merged.\n\nBest Wishes\n\nPhillip\n\nOn 07/10/2024 12:10, Kristoffer Haugsbakk wrote:\n> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n> \n> \n> Kristoffer Haugsbakk (3):\n>    doc: merge-tree: provide a commit message\n>    doc: merge-tree: use lower-case variables\n>    doc: merge-tree: use || directly\n> \n>   Documentation/git-merge-tree.txt | 14 ++++++++------\n>   1 file changed, 8 insertions(+), 6 deletions(-)\n> \n> --\n> 2.46.1.641.g54e7913fcb6\n> \n\n"},{"id":"504331","messageId":"002b3e89-fa60-4927-bae3-bf95bdfd60cf@app.fastmail.com","threadId":"62267","inReplyTo":"3ce39bec-24e4-4850-b947-e6476fac5132@gmail.com","subject":"Re: [PATCH 0/3] doc: merge-tree: improve the script example","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-07T15:00:28Z","receivedAt":"2024-10-07T15:00:51Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Mon, Oct 7, 2024, at 16:59, Phillip Wood wrote:\n> Hi Kristoffer\n>\n> Thanks for working on this. Patches 1 and 3 look like clear improvements \n> to me, I've left a comment on patch 2 as the improvement is less clear \n> to me but I wouldn't object to it being merged.\n>\n> Best Wishes\n>\n> Phillip\n\nThanks for taking a look!\n\n-- \nKristoffer Haugsbakk\n"},{"id":"504333","messageId":"CABPp-BHoYSmxCDDXhC8MGxGV+wzaNc96Fbv60JAbhgX9O_x7oQ@mail.gmail.com","threadId":"62267","inReplyTo":"fef203471f4492af1468a0c91088324c394effd5.1728298931.git.code@khaugsbakk.name","subject":"Re: [PATCH 1/3] doc: merge-tree: provide a commit message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2024-10-07T15:17:51Z","receivedAt":"2024-10-07T15:18:03Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk\n<code@khaugsbakk.name> wrote:\n>\n> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n>\n> From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>\n> Provide a commit message in the example command.\n>\n> The command will hang since it is waiting for a commit message on\n> stdin.  Which is usable but not straightforward enough since this is\n> example code.\n\nThis is fine, but...\n\n>\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n>\n> Notes (series):\n>     Unlike on some other manuals you probably won’t end up running these\n>     commands directly to test things out.  But you might end up copying and\n>     modifying it when playing around with the command.\n>\n>  Documentation/git-merge-tree.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\n> index 84cb2edf6d0..590cbf5df79 100644\n> --- a/Documentation/git-merge-tree.txt\n> +++ b/Documentation/git-merge-tree.txt\n> @@ -213,7 +213,7 @@ used as a part of a series of steps such as:\n>\n>         NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n>         test $? -eq 0 || die \"There were conflicts...\"\n> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n> +       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n\n...perhaps this can be -F ${FILE_WITH_COMMIT_MESSAGE} ?  I personally\nhave a problem with writing example code that models horrible commit\nmessages; I'd rather give them an example that hangs waiting on stdin\nthan do that.\n\n>         git update-ref $BRANCH1 $NEWCOMMIT\n>\n>  Note that when the exit status is non-zero, `NEWTREE` in this sequence\n> --\n> 2.46.1.641.g54e7913fcb6\n"},{"id":"504334","messageId":"CABPp-BFogoe5+X8aTpLF8ksVbZJxwXOw-TCh6k5aAJctxUzZUw@mail.gmail.com","threadId":"62267","inReplyTo":"d18f6fdf-d0ba-40e1-a2b9-2fecfbdadde4@gmail.com","subject":"Re: [PATCH 2/3] doc: merge-tree: use lower-case variables","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2024-10-07T15:22:03Z","receivedAt":"2024-10-07T15:22:15Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Oct 7, 2024 at 7:58 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> Hi Kristoffer\n>\n> On 07/10/2024 12:10, Kristoffer Haugsbakk wrote:\n> > From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n> >\n> > From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> >\n> > This is easier to read.\n>\n> I think that is a matter of taste, one could argue that using uppercase\n> variable names makes them stand out so the user can see which arguments\n> are parameters more clearly.\n\nYeah, I wrote it as uppercase because I thought that was easier to\nread for the reasons Phillip gives.  It's not a strong preference, but\nI do think the commit message needs a more detailed rationale or link\nto an agreed project coding style or something, otherwise the commit\nmessage may appear to be false to half the readers.\n"},{"id":"504336","messageId":"2fe12309-7b5b-487b-bcf4-0639a1dc610d@app.fastmail.com","threadId":"62267","inReplyTo":"CABPp-BHoYSmxCDDXhC8MGxGV+wzaNc96Fbv60JAbhgX9O_x7oQ@mail.gmail.com","subject":"Re: [PATCH 1/3] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-07T15:23:27Z","receivedAt":"2024-10-07T15:23:48Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Mon, Oct 7, 2024, at 17:17, Elijah Newren wrote:\n>>         NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n>>         test $? -eq 0 || die \"There were conflicts...\"\n>> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n>> +       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n>\n> ...perhaps this can be -F ${FILE_WITH_COMMIT_MESSAGE} ?  I personally\n> have a problem with writing example code that models horrible commit\n> messages; I'd rather give them an example that hangs waiting on stdin\n> than do that.\n\nYes.  I’ll do that in the reroll.\n\nBoth this part and the uppercase variables.\n\nCheers\n\n-- \nKristoffer Haugsbakk\n"},{"id":"504337","messageId":"CABPp-BFG0KQVzu_AT-GwW0rg0Ly3uVY1+M4Sgh5E8Gn9A=5BKQ@mail.gmail.com","threadId":"62267","inReplyTo":"4057d6386125e51fd934f92abd11c62a9d24a832.1728298931.git.code@khaugsbakk.name","subject":"Re: [PATCH 3/3] doc: merge-tree: use || directly","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2024-10-07T15:24:19Z","receivedAt":"2024-10-07T15:24:32Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk\n<code@khaugsbakk.name> wrote:\n>\n> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n>\n> From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>\n> Use `||` directly since that is more straightforward than checking the\n> last exit status.\n>\n> Also use `echo` and `exit` since `die` is not defined.\n\nNot defined where?  It's defined in my scripts...  ;-)\n\nJust kidding; this is a good change.\n\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n>  Documentation/git-merge-tree.txt | 6 ++++--\n>  1 file changed, 4 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\n> index 10f8ac7f80a..46091da022d 100644\n> --- a/Documentation/git-merge-tree.txt\n> +++ b/Documentation/git-merge-tree.txt\n> @@ -211,8 +211,10 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n>  linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n>  used as a part of a series of steps such as:\n>\n> -       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n> -       test $? -eq 0 || die \"There were conflicts...\"\n> +       newtree=$(git merge-tree --write-tree $branch1 $branch2) || {\n> +           echo \"There were conflicts...\" 1>&2\n> +           exit 1\n> +       }\n\nThanks.\n"},{"id":"504343","messageId":"5cfe7170-3fd5-432f-b6af-702b8cb2f611@app.fastmail.com","threadId":"62267","inReplyTo":"CABPp-BFG0KQVzu_AT-GwW0rg0Ly3uVY1+M4Sgh5E8Gn9A=5BKQ@mail.gmail.com","subject":"Re: [PATCH 3/3] doc: merge-tree: use || directly","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-07T15:44:46Z","receivedAt":"2024-10-07T15:45:08Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Mon, Oct 7, 2024, at 17:24, Elijah Newren wrote:\n> On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk\n> <code@khaugsbakk.name> wrote:\n>>\n>> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>\n>>\n>> From: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>>\n>> Use `||` directly since that is more straightforward than checking the\n>> last exit status.\n>>\n>> Also use `echo` and `exit` since `die` is not defined.\n>\n> Not defined where?  It's defined in my scripts...  ;-)\n>\n> Just kidding; this is a good change.\n\n:D\n\nThanks for taking a look! I’ll send the second version tomorrow.\n\n-- \nKristoffer Haugsbakk\n\n"},{"id":"504476","messageId":"cover.1728413450.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728298931.git.code@khaugsbakk.name","subject":"[PATCH v2 0/2] doc: merge-tree: improve the script example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-08T19:06:04Z","receivedAt":"2024-10-08T19:06:56Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"§ Changes since v1\n\nPatches:\n\n• v1 1: v2 1: use a file instead of `-mMerge` for the commit message\n• v1 2: dropped (lower-case variables)\n• v1 3: v2 2: no changes\n\nKristoffer Haugsbakk (2):\n  doc: merge-tree: provide a commit message\n  doc: merge-tree: use || directly\n\n Documentation/git-merge-tree.txt | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\nInterdiff against v1:\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 46091da022d..41dfb16476d 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,14 +211,15 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n-       newtree=$(git merge-tree --write-tree $branch1 $branch2) || {\n+       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n            echo \"There were conflicts...\" 1>&2\n            exit 1\n        }\n-       newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n-       git update-ref $branch1 $newcommit\n+       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n+           -p $BRANCH1 -p $BRANCH2)\n+       git update-ref $BRANCH1 $NEWCOMMIT\n \n-Note that when the exit status is non-zero, `newtree` in this sequence\n+Note that when the exit status is non-zero, `NEWTREE` in this sequence\n will contain a lot more output than just a tree.\n \n For conflicts, the output includes the same information that you'd get\nRange-diff against v1:\n1:  6b05526c327 < -:  ----------- doc: merge-tree: provide a commit message\n2:  7d4deaee6c4 ! 1:  b1ca5cae768 doc: merge-tree: use lower-case variables\n    @@ Metadata\n     Author: Kristoffer Haugsbakk <code@khaugsbakk.name>\n     \n      ## Commit message ##\n    -    doc: merge-tree: use lower-case variables\n    +    doc: merge-tree: provide a commit message\n     \n    -    This is easier to read.\n    +    Provide a commit message in the example command.\n    +\n    +    The command will hang since it is waiting for a commit message on\n    +    stdin.  Which is usable but not straightforward enough since this is\n    +    example code.\n     \n         Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n     \n    +\n    + ## Notes (series) ##\n    +    Unlike on some other manuals you probably won’t end up running these\n    +    commands directly to test things out.  But you might end up copying and\n    +    modifying it when playing around with the command.\n    +\n      ## Documentation/git-merge-tree.txt ##\n    -@@ Documentation/git-merge-tree.txt: linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n    - linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n    - used as a part of a series of steps such as:\n    +@@ Documentation/git-merge-tree.txt: used as a part of a series of steps such as:\n      \n    --       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n    -+       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n    +        NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n             test $? -eq 0 || die \"There were conflicts...\"\n    --       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)\n    --       git update-ref $BRANCH1 $NEWCOMMIT\n    -+       newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n    -+       git update-ref $branch1 $newcommit\n    - \n    --Note that when the exit status is non-zero, `NEWTREE` in this sequence\n    -+Note that when the exit status is non-zero, `newtree` in this sequence\n    - will contain a lot more output than just a tree.\n    +-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n    ++       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n    ++           -p $BRANCH1 -p $BRANCH2)\n    +        git update-ref $BRANCH1 $NEWCOMMIT\n      \n    - For conflicts, the output includes the same information that you'd get\n    + Note that when the exit status is non-zero, `NEWTREE` in this sequence\n3:  1b60dc810e3 ! 2:  13e0f3bed5d doc: merge-tree: use || directly\n    @@ Documentation/git-merge-tree.txt: linkgit:git-commit-tree[1], linkgit:git-write-\n      linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n      used as a part of a series of steps such as:\n      \n    --       newtree=$(git merge-tree --write-tree $branch1 $branch2)\n    +-       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n     -       test $? -eq 0 || die \"There were conflicts...\"\n    -+       newtree=$(git merge-tree --write-tree $branch1 $branch2) || {\n    ++       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n     +           echo \"There were conflicts...\" 1>&2\n     +           exit 1\n     +       }\n    -        newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2)\n    -        git update-ref $branch1 $newcommit\n    - \n    +        NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n    +            -p $BRANCH1 -p $BRANCH2)\n    +        git update-ref $BRANCH1 $NEWCOMMIT\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504477","messageId":"b1ca5cae76845f84147d385cc5ff47f219cd471e.1728413450.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728413450.git.code@khaugsbakk.name","subject":"[PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-08T19:06:05Z","receivedAt":"2024-10-08T19:07:00Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Provide a commit message in the example command.\n\nThe command will hang since it is waiting for a commit message on\nstdin.  Which is usable but not straightforward enough since this is\nexample code.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    Unlike on some other manuals you probably won’t end up running these\n    commands directly to test things out.  But you might end up copying and\n    modifying it when playing around with the command.\n\n Documentation/git-merge-tree.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 84cb2edf6d0..d1157f1398a 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -213,7 +213,8 @@ used as a part of a series of steps such as:\n \n        NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n        test $? -eq 0 || die \"There were conflicts...\"\n-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n+       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n+           -p $BRANCH1 -p $BRANCH2)\n        git update-ref $BRANCH1 $NEWCOMMIT\n \n Note that when the exit status is non-zero, `NEWTREE` in this sequence\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504478","messageId":"13e0f3bed5dd894ee692c672b301697e0a909e04.1728413450.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728413450.git.code@khaugsbakk.name","subject":"[PATCH v2 2/2] doc: merge-tree: use || directly","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-08T19:06:06Z","receivedAt":"2024-10-08T19:07:04Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Use `||` directly since that is more straightforward than checking the\nlast exit status.\n\nAlso use `echo` and `exit` since `die` is not defined.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-merge-tree.txt | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex d1157f1398a..41dfb16476d 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,8 +211,10 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n-       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n-       test $? -eq 0 || die \"There were conflicts...\"\n+       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n+           echo \"There were conflicts...\" 1>&2\n+           exit 1\n+       }\n        NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n            -p $BRANCH1 -p $BRANCH2)\n        git update-ref $BRANCH1 $NEWCOMMIT\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504485","messageId":"xmqqo73uz5qg.fsf@gitster.g","threadId":"62267","inReplyTo":"b1ca5cae76845f84147d385cc5ff47f219cd471e.1728413450.git.code@khaugsbakk.name","subject":"Re: [PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-08T20:42:31Z","receivedAt":"2024-10-08T20:42:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> Provide a commit message in the example command.\n>\n> The command will hang since it is waiting for a commit message on\n> stdin.  Which is usable but not straightforward enough since this is\n> example code.\n>\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n\nMakes sense.\n\n> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n> +       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n> +           -p $BRANCH1 -p $BRANCH2)\n>         git update-ref $BRANCH1 $NEWCOMMIT\n\nThe shell should know, after seeing $FILE_WITH_COMMIT_MESSAGE and\nencountering the end of line, that you haven't completed telling\nwhat you started telling it.  Do you need \" \\\" at the end of the\nline?\n\nI know that it was suggested to use a file with message, and I agree\nwith the suggestion, but then I wonder if we want to be more\ncomplete and show that a file gets prepared in the example to avoid\nmaking readers wonder where $FILE_WITH_COMMIT_MESSAGE comes from?\n\nE.g.,\n\n        vi message.txt\n        NEWCOMMIT=$(git comimt-tree $NEWTREE -F message.txt\n                    -p $BRANCH1 -p $BRANCH2)\n\nor something like that?\n\nOther than that, looking good.\n\nThanks.\n\n"},{"id":"504486","messageId":"xmqqjzeiz5ne.fsf@gitster.g","threadId":"62267","inReplyTo":"13e0f3bed5dd894ee692c672b301697e0a909e04.1728413450.git.code@khaugsbakk.name","subject":"Re: [PATCH v2 2/2] doc: merge-tree: use || directly","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-08T20:44:21Z","receivedAt":"2024-10-08T20:44:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> -       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n> -       test $? -eq 0 || die \"There were conflicts...\"\n> +       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n> +           echo \"There were conflicts...\" 1>&2\n> +           exit 1\n> +       }\n\nMakes sense.  Was there a particular reason why these two patches\nhad to be done in two separate steps?\n\nLooking good otherwise.  Thanks.\n"},{"id":"504487","messageId":"eb4ced86-03af-41c0-85c6-0f7df2819190@app.fastmail.com","threadId":"62267","inReplyTo":"xmqqo73uz5qg.fsf@gitster.g","subject":"Re: [PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-08T20:44:39Z","receivedAt":"2024-10-08T20:45:01Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Tue, Oct 8, 2024, at 22:42, Junio C Hamano wrote:\n> The shell should know, after seeing $FILE_WITH_COMMIT_MESSAGE and\n> encountering the end of line, that you haven't completed telling\n> what you started telling it.  Do you need \" \\\" at the end of the\n> line?\n\nHeh, I’m not sure.  I’ll delete it if I don’t.\n\n> I know that it was suggested to use a file with message, and I agree\n> with the suggestion, but then I wonder if we want to be more\n> complete and show that a file gets prepared in the example to avoid\n> making readers wonder where $FILE_WITH_COMMIT_MESSAGE comes from?\n\nSure thing\n\nThanks :)\n\n-- \n  Kristoffer Haugsbakk\n  kristofferhaugsbakk@fastmail.com\n"},{"id":"504489","messageId":"17013309-80a9-4cf6-8881-40df56413603@app.fastmail.com","threadId":"62267","inReplyTo":"xmqqjzeiz5ne.fsf@gitster.g","subject":"Re: [PATCH v2 2/2] doc: merge-tree: use || directly","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-08T20:48:15Z","receivedAt":"2024-10-08T20:48:36Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Tue, Oct 8, 2024, at 22:44, Junio C Hamano wrote:\n> Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n>\n>> -       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n>> -       test $? -eq 0 || die \"There were conflicts...\"\n>> +       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n>> +           echo \"There were conflicts...\" 1>&2\n>> +           exit 1\n>> +       }\n>\n> Makes sense.  Was there a particular reason why these two patches\n> had to be done in two separate steps?\n>\n> Looking good otherwise.  Thanks.\n\nJust my usual do-one-thing-per-commit.\n\nIn this case a simple Also-paragraph can connect the two. So squashing\nthem is fine too.\n\n-- \n  Kristoffer Haugsbakk\n  kristofferhaugsbakk@fastmail.com\n\n"},{"id":"504601","messageId":"e339f796-bb9c-439f-a24c-0c5e79257379@app.fastmail.com","threadId":"62267","inReplyTo":"xmqqo73uz5qg.fsf@gitster.g","subject":"Re: [PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2024-10-09T16:35:36Z","receivedAt":"2024-10-09T16:35:57Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Tue, Oct 8, 2024, at 22:42, Junio C Hamano wrote:\n> Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n>\n>> Provide a commit message in the example command.\n>>\n>> The command will hang since it is waiting for a commit message on\n>> stdin.  Which is usable but not straightforward enough since this is\n>> example code.\n>>\n>> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>> ---\n>\n> Makes sense.\n>\n>> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n>> +       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n>> +           -p $BRANCH1 -p $BRANCH2)\n>>         git update-ref $BRANCH1 $NEWCOMMIT\n>\n> The shell should know, after seeing $FILE_WITH_COMMIT_MESSAGE and\n> encountering the end of line, that you haven't completed telling\n> what you started telling it.  Do you need \" \\\" at the end of the\n> line?\n\nI tried that and got an error: `-p: not found`.\n\n> I know that it was suggested to use a file with message, and I agree\n> with the suggestion, but then I wonder if we want to be more\n> complete and show that a file gets prepared in the example to avoid\n> making readers wonder where $FILE_WITH_COMMIT_MESSAGE comes from?\n>\n> E.g.,\n>\n>         vi message.txt\n>         NEWCOMMIT=$(git comimt-tree $NEWTREE -F message.txt\n>                     -p $BRANCH1 -p $BRANCH2)\n>\n> or something like that?\n\nI’ll do that.\n\n--\nKristoffer but any Christopher-variation is fine\n"},{"id":"504602","messageId":"cover.1728492617.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728413450.git.code@khaugsbakk.name","subject":"[PATCH v3 0/1] doc: merge-tree: improve the script example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-09T16:53:44Z","receivedAt":"2024-10-09T16:54:19Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"§ Changes since v2\n\n• Squash into one patch\n• Use `vi message.txt` before `git commit-tree`\n• Also declare the branches\n  • Fully qualified for `BRANCH1` since it is passed to\n    git-update-ref(1)\n\nKristoffer Haugsbakk (1):\n  doc: merge-tree: improve example script\n\n Documentation/git-merge-tree.txt | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\nInterdiff against v2:\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 41dfb16476d..0b6a8a19b1f 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,11 +211,14 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n+       vi message.txt\n+       BRANCH1=refs/heads/test\n+       BRANCH2=main\n        NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n            echo \"There were conflicts...\" 1>&2\n            exit 1\n        }\n-       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n+       NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \\\n            -p $BRANCH1 -p $BRANCH2)\n        git update-ref $BRANCH1 $NEWCOMMIT\n \nRange-diff against v2:\n1:  b1ca5cae768 < -:  ----------- doc: merge-tree: provide a commit message\n2:  13e0f3bed5d ! 1:  c7e0d76e71e doc: merge-tree: use || directly\n    @@ Metadata\n     Author: Kristoffer Haugsbakk <code@khaugsbakk.name>\n     \n      ## Commit message ##\n    -    doc: merge-tree: use || directly\n    +    doc: merge-tree: improve example script\n     \n    -    Use `||` directly since that is more straightforward than checking the\n    -    last exit status.\n    +    • Provide a commit message in the example command.\n     \n    -    Also use `echo` and `exit` since `die` is not defined.\n    +      The command will hang since it is waiting for a commit message on\n    +      stdin.  Which is usable but not straightforward enough since this is\n    +      example code.\n    +    • Use `||` directly since that is more straightforward than checking the\n    +      last exit status.\n    +\n    +      Also use `echo` and `exit` since `die` is not defined.\n    +    • Expose variable declarations.\n     \n         Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n     \n    @@ Documentation/git-merge-tree.txt: linkgit:git-commit-tree[1], linkgit:git-write-\n      \n     -       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n     -       test $? -eq 0 || die \"There were conflicts...\"\n    +-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n    ++       vi message.txt\n    ++       BRANCH1=refs/heads/test\n    ++       BRANCH2=main\n     +       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n     +           echo \"There were conflicts...\" 1>&2\n     +           exit 1\n     +       }\n    -        NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n    -            -p $BRANCH1 -p $BRANCH2)\n    ++       NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \\\n    ++           -p $BRANCH1 -p $BRANCH2)\n             git update-ref $BRANCH1 $NEWCOMMIT\n    + \n    + Note that when the exit status is non-zero, `NEWTREE` in this sequence\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504603","messageId":"c7e0d76e71eef56c6279e0f7e82a2d194f78d2a4.1728492617.git.code@khaugsbakk.name","threadId":"62267","inReplyTo":"cover.1728492617.git.code@khaugsbakk.name","subject":"[PATCH v3 1/1] doc: merge-tree: improve example script","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-10-09T16:53:45Z","receivedAt":"2024-10-09T16:54:23Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"• Provide a commit message in the example command.\n\n  The command will hang since it is waiting for a commit message on\n  stdin.  Which is usable but not straightforward enough since this is\n  example code.\n• Use `||` directly since that is more straightforward than checking the\n  last exit status.\n\n  Also use `echo` and `exit` since `die` is not defined.\n• Expose variable declarations.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-merge-tree.txt | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\nindex 84cb2edf6d0..0b6a8a19b1f 100644\n--- a/Documentation/git-merge-tree.txt\n+++ b/Documentation/git-merge-tree.txt\n@@ -211,9 +211,15 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n used as a part of a series of steps such as:\n \n-       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n-       test $? -eq 0 || die \"There were conflicts...\"\n-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n+       vi message.txt\n+       BRANCH1=refs/heads/test\n+       BRANCH2=main\n+       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n+           echo \"There were conflicts...\" 1>&2\n+           exit 1\n+       }\n+       NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \\\n+           -p $BRANCH1 -p $BRANCH2)\n        git update-ref $BRANCH1 $NEWCOMMIT\n \n Note that when the exit status is non-zero, `NEWTREE` in this sequence\n-- \n2.46.1.641.g54e7913fcb6\n\n"},{"id":"504604","messageId":"878quxfc2h.fsf@igel.home","threadId":"62267","inReplyTo":"xmqqo73uz5qg.fsf@gitster.g","subject":"Re: [PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2024-10-09T16:58:14Z","receivedAt":"2024-10-09T16:58:24Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Okt 08 2024, Junio C Hamano wrote:\n\n>> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n>> +       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n>> +           -p $BRANCH1 -p $BRANCH2)\n>>         git update-ref $BRANCH1 $NEWCOMMIT\n>\n> The shell should know, after seeing $FILE_WITH_COMMIT_MESSAGE and\n> encountering the end of line, that you haven't completed telling\n> what you started telling it.  Do you need \" \\\" at the end of the\n> line?\n\nThe contents of $(...) is a (multiline) shell script, with the same\nwhitespace and newline rules as a regular script.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"504615","messageId":"xmqq5xq1uqfi.fsf@gitster.g","threadId":"62267","inReplyTo":"e339f796-bb9c-439f-a24c-0c5e79257379@app.fastmail.com","subject":"Re: [PATCH v2 1/2] doc: merge-tree: provide a commit message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-09T17:38:57Z","receivedAt":"2024-10-09T17:38:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kristoffer Haugsbakk\" <kristofferhaugsbakk@fastmail.com> writes:\n\n>>> +       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n>>> +           -p $BRANCH1 -p $BRANCH2)\n>>>         git update-ref $BRANCH1 $NEWCOMMIT\n>>\n>> The shell should know, after seeing $FILE_WITH_COMMIT_MESSAGE and\n>> encountering the end of line, that you haven't completed telling\n>> what you started telling it.  Do you need \" \\\" at the end of the\n>> line?\n>\n> I tried that and got an error: `-p: not found`.\n\nThanks for trying.  Sorry, but I think I got confused by trying it\nwith two \"echo\" (one per line).  The newline still acts as a\ninter-command separator.\n\n>> E.g.,\n>>\n>>         vi message.txt\n>>         NEWCOMMIT=$(git comimt-tree $NEWTREE -F message.txt\n>>                     -p $BRANCH1 -p $BRANCH2)\n>>\n>> or something like that?\n>\n> I’ll do that.\n"},{"id":"504651","messageId":"CABPp-BE=JfoZp19Va-1oF60ADBUibGDwDkFX-Zytx7A3uJ__gg@mail.gmail.com","threadId":"62267","inReplyTo":"cover.1728492617.git.code@khaugsbakk.name","subject":"Re: [PATCH v3 0/1] doc: merge-tree: improve the script example","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2024-10-09T20:50:10Z","receivedAt":"2024-10-09T20:50:23Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Oct 9, 2024 at 9:54 AM Kristoffer Haugsbakk\n<code@khaugsbakk.name> wrote:\n>\n> § Changes since v2\n>\n> • Squash into one patch\n> • Use `vi message.txt` before `git commit-tree`\n> • Also declare the branches\n>   • Fully qualified for `BRANCH1` since it is passed to\n>     git-update-ref(1)\n>\n> Kristoffer Haugsbakk (1):\n>   doc: merge-tree: improve example script\n>\n>  Documentation/git-merge-tree.txt | 12 +++++++++---\n>  1 file changed, 9 insertions(+), 3 deletions(-)\n>\n> Interdiff against v2:\n> diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt\n> index 41dfb16476d..0b6a8a19b1f 100644\n> --- a/Documentation/git-merge-tree.txt\n> +++ b/Documentation/git-merge-tree.txt\n> @@ -211,11 +211,14 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1],\n>  linkgit:git-update-ref[1], and linkgit:git-mktag[1].  Thus, it can be\n>  used as a part of a series of steps such as:\n>\n> +       vi message.txt\n> +       BRANCH1=refs/heads/test\n> +       BRANCH2=main\n>         NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n>             echo \"There were conflicts...\" 1>&2\n>             exit 1\n>         }\n> -       NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n> +       NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \\\n>             -p $BRANCH1 -p $BRANCH2)\n>         git update-ref $BRANCH1 $NEWCOMMIT\n>\n> Range-diff against v2:\n> 1:  b1ca5cae768 < -:  ----------- doc: merge-tree: provide a commit message\n> 2:  13e0f3bed5d ! 1:  c7e0d76e71e doc: merge-tree: use || directly\n>     @@ Metadata\n>      Author: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>\n>       ## Commit message ##\n>     -    doc: merge-tree: use || directly\n>     +    doc: merge-tree: improve example script\n>\n>     -    Use `||` directly since that is more straightforward than checking the\n>     -    last exit status.\n>     +    • Provide a commit message in the example command.\n>\n>     -    Also use `echo` and `exit` since `die` is not defined.\n>     +      The command will hang since it is waiting for a commit message on\n>     +      stdin.  Which is usable but not straightforward enough since this is\n>     +      example code.\n>     +    • Use `||` directly since that is more straightforward than checking the\n>     +      last exit status.\n>     +\n>     +      Also use `echo` and `exit` since `die` is not defined.\n>     +    • Expose variable declarations.\n>\n>          Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n>\n>     @@ Documentation/git-merge-tree.txt: linkgit:git-commit-tree[1], linkgit:git-write-\n>\n>      -       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)\n>      -       test $? -eq 0 || die \"There were conflicts...\"\n>     +-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)\n>     ++       vi message.txt\n>     ++       BRANCH1=refs/heads/test\n>     ++       BRANCH2=main\n>      +       NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2) || {\n>      +           echo \"There were conflicts...\" 1>&2\n>      +           exit 1\n>      +       }\n>     -        NEWCOMMIT=$(git commit-tree $NEWTREE -F $FILE_WITH_COMMIT_MESSAGE \\\n>     -            -p $BRANCH1 -p $BRANCH2)\n>     ++       NEWCOMMIT=$(git commit-tree $NEWTREE -F message.txt \\\n>     ++           -p $BRANCH1 -p $BRANCH2)\n>              git update-ref $BRANCH1 $NEWCOMMIT\n>     +\n>     + Note that when the exit status is non-zero, `NEWTREE` in this sequence\n> --\n> 2.46.1.641.g54e7913fcb6\n\nThis round looks good to me; thanks.\n"},{"id":"504663","messageId":"xmqqbjzsomfi.fsf@gitster.g","threadId":"62267","inReplyTo":"CABPp-BE=JfoZp19Va-1oF60ADBUibGDwDkFX-Zytx7A3uJ__gg@mail.gmail.com","subject":"Re: [PATCH v3 0/1] doc: merge-tree: improve the script example","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-10-10T00:01:53Z","receivedAt":"2024-10-10T00:01:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Wed, Oct 9, 2024 at 9:54 AM Kristoffer Haugsbakk\n> <code@khaugsbakk.name> wrote:\n>> ...\n>> 2.46.1.641.g54e7913fcb6\n>\n> This round looks good to me; thanks.\n\nThanks.\n"}]}