diff mbox series

[1/3] doc: merge-tree: provide a commit message

Message ID fef203471f4492af1468a0c91088324c394effd5.1728298931.git.code@khaugsbakk.name (mailing list archive)
State New
Headers show
Series doc: merge-tree: improve the script example | expand

Commit Message

Kristoffer Haugsbakk Oct. 7, 2024, 11:10 a.m. UTC
From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>

From: Kristoffer Haugsbakk <code@khaugsbakk.name>

Provide a commit message in the example command.

The command will hang since it is waiting for a commit message on
stdin.  Which is usable but not straightforward enough since this is
example code.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---

Notes (series):
    Unlike on some other manuals you probably won’t end up running these
    commands directly to test things out.  But you might end up copying and
    modifying it when playing around with the command.

 Documentation/git-merge-tree.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kristoffer Haugsbakk Oct. 7, 2024, 12:02 p.m. UTC | #1
On Mon, Oct 7, 2024, at 13:10, Kristoffer Haugsbakk wrote:
> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
>
> From: Kristoffer Haugsbakk <code@khaugsbakk.name>

I think these got double upped since I used `--from` in format-patch.
Then I used send-email.  format-patch warns against that:

  “ Note that this option is only useful if you are actually sending the
    emails and want to identify yourself as the sender, but
    retain the original author (and git am will correctly pick up
    the in-body header). Note also that git send-email already
    handles this transformation for you, and this option should
    not be used if you are feeding the result to git send-email.

So under the normal use I guess:

• You have someone else’s patches
• send-email sees that you are not that person (because of your config)
• It puts the From in the message body (it just works)

But that wasn’t the case for me since my ident is still the same as the
author.

That went over my head before I sent.
Elijah Newren Oct. 7, 2024, 3:17 p.m. UTC | #2
On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk
<code@khaugsbakk.name> wrote:
>
> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
>
> From: Kristoffer Haugsbakk <code@khaugsbakk.name>
>
> Provide a commit message in the example command.
>
> The command will hang since it is waiting for a commit message on
> stdin.  Which is usable but not straightforward enough since this is
> example code.

This is fine, but...

>
> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
> ---
>
> Notes (series):
>     Unlike on some other manuals you probably won’t end up running these
>     commands directly to test things out.  But you might end up copying and
>     modifying it when playing around with the command.
>
>  Documentation/git-merge-tree.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt
> index 84cb2edf6d0..590cbf5df79 100644
> --- a/Documentation/git-merge-tree.txt
> +++ b/Documentation/git-merge-tree.txt
> @@ -213,7 +213,7 @@ used as a part of a series of steps such as:
>
>         NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
>         test $? -eq 0 || die "There were conflicts..."
> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
> +       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)

...perhaps this can be -F ${FILE_WITH_COMMIT_MESSAGE} ?  I personally
have a problem with writing example code that models horrible commit
messages; I'd rather give them an example that hangs waiting on stdin
than do that.

>         git update-ref $BRANCH1 $NEWCOMMIT
>
>  Note that when the exit status is non-zero, `NEWTREE` in this sequence
> --
> 2.46.1.641.g54e7913fcb6
Kristoffer Haugsbakk Oct. 7, 2024, 3:23 p.m. UTC | #3
On Mon, Oct 7, 2024, at 17:17, Elijah Newren wrote:
>>         NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
>>         test $? -eq 0 || die "There were conflicts..."
>> -       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
>> +       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)
>
> ...perhaps this can be -F ${FILE_WITH_COMMIT_MESSAGE} ?  I personally
> have a problem with writing example code that models horrible commit
> messages; I'd rather give them an example that hangs waiting on stdin
> than do that.

Yes.  I’ll do that in the reroll.

Both this part and the uppercase variables.

Cheers
diff mbox series

Patch

diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt
index 84cb2edf6d0..590cbf5df79 100644
--- a/Documentation/git-merge-tree.txt
+++ b/Documentation/git-merge-tree.txt
@@ -213,7 +213,7 @@  used as a part of a series of steps such as:
 
        NEWTREE=$(git merge-tree --write-tree $BRANCH1 $BRANCH2)
        test $? -eq 0 || die "There were conflicts..."
-       NEWCOMMIT=$(git commit-tree $NEWTREE -p $BRANCH1 -p $BRANCH2)
+       NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2)
        git update-ref $BRANCH1 $NEWCOMMIT
 
 Note that when the exit status is non-zero, `NEWTREE` in this sequence