From: Junio C Hamano <gitster@pobox.com>
To: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH] reset: avoid reflog update on no-op reset
Date: Thu, 22 Jan 2026 10:57:02 -0800 [thread overview]
Message-ID: <xmqqwm19mq69.fsf@gitster.g> (raw)
In-Reply-To: <20260122154743.20496-3-pushkarkumarsingh1970@gmail.com> (Pushkar Singh's message of "Thu, 22 Jan 2026 15:47:45 +0000")
Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:
> When "git reset" is invoked with a target that already matches HEAD,
> it currently writes a reflog entry even though no reference is updated.
>
> Detect this no-op case and avoid updating ORIG_HEAD and HEAD, skipping
> the reflog entry entirely.
I am mildly negative on this one. A scripted use that gets which
commit to reset to from the caller in the outside world, e.g.,
#!/bin/sh
git reset --hard "$1"
git diff --stat @{1}
would be confused if reflog does not reliably store the state before
running "reset --hard" to @{1}. In other words ...
> Add a regression test to ensure no reflog entry is written for a no-op
> reset.
... this change may already be a regression for existing users.
next prev parent reply other threads:[~2026-01-22 18:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 15:47 [PATCH] reset: avoid reflog update on no-op reset Pushkar Singh
2026-01-22 18:57 ` Junio C Hamano [this message]
2026-01-22 19:09 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2026-01-23 8:54 Pushkar Singh
2026-01-23 16:18 ` 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=xmqqwm19mq69.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=pushkarkumarsingh1970@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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