public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, Elijah Newren <newren@gmail•com>
Subject: Re: [PATCH v2] replay: drop commits that become empty
Date: Wed, 17 Dec 2025 14:45:54 +0000	[thread overview]
Message-ID: <d54c50ef-9d6c-498c-aca3-ed4461733190@gmail.com> (raw)
In-Reply-To: <xmqqpl8f719x.fsf@gitster.g>

On 15/12/2025 23:50, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail•com> writes:
>> diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
>> index cf3aacf3551..9d4b0dd1a77 100755
>> --- a/t/t3650-replay-basics.sh
>> +++ b/t/t3650-replay-basics.sh
>> @@ -25,6 +25,8 @@ test_expect_success 'setup' '
>>   	git switch -c topic3 &&
>>   	test_commit G &&
>>   	test_commit H &&
>> +	git switch -c empty &&
>> +	git commit --allow-empty --only -m empty &&
> 
> The use of "--only" here is a bit curious.  As there is no change
> between the index and the commit our "empty" branch points at,
> wouldn't it be unnecessary?  The option, together with --allow-empty,
> would only matter if you did
> 
> 	git switch -c empty &&
> 	modify blah &&
> 	git add blah &&
> 	git commit --allow-empty --only -m empty
> 
> because without --only, the changes to blah will be taken.

I've got into the habit of always adding "--only" when I want to create 
an empty commit in case there are staged changes. I don't really like 
"--allow-empty" as I've never wanted to create commit that might or 
might not be empty - either I want to create an empty commit in which 
case I don't want to commit any staged changes, or I want the commit to 
fail if there are no staged changes). I can remove it if you want.

Thanks

Phillip


  parent reply	other threads:[~2025-12-17 14:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 16:15 [PATCH] replay: drop commits that become empty Phillip Wood
2025-11-28  7:29 ` Junio C Hamano
2025-12-04 14:08   ` Phillip Wood
2025-11-28  8:06 ` Elijah Newren
2025-12-04 14:06   ` Phillip Wood
2025-12-15 10:07 ` [PATCH v2] " Phillip Wood
2025-12-15 23:50   ` Junio C Hamano
2025-12-16 14:19     ` Phillip Wood
2025-12-17 14:45     ` Phillip Wood [this message]
2025-12-17 23:49       ` Junio C Hamano
2025-12-16  0:21   ` Elijah Newren
2025-12-16 14:19 ` [PATCH v3] " Phillip Wood
2025-12-16 16:36   ` Elijah Newren
2025-12-17 14:47     ` Phillip Wood
2025-12-18 16:50 ` [PATCH v4] " Phillip Wood
2025-12-19  4:44   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d54c50ef-9d6c-498c-aca3-ed4461733190@gmail.com \
    --to=phillip.wood123@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=newren@gmail$(echo .)com \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox