Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>,
	Pablo Sabater <pabloosabaterr@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Subject: Re: [PATCH RFC 2/2] builtin/history: print feedback after successful reword
Date: Wed, 8 Jul 2026 14:04:49 +0200	[thread overview]
Message-ID: <ak484Ywk97k-8ULs@pks.im> (raw)
In-Reply-To: <CALnO6CAjZfK3hPWn1vOxgw=4=cjRYEHabYJmJrpVVDU8yyQn_g@mail.gmail.com>

On Tue, Jul 07, 2026 at 12:10:12PM -0400, D. Ben Knoble wrote:
> On Tue, Jul 7, 2026 at 1:09 AM Dominique Martinet
> <asmadeus@codewreck.org> wrote:
[snip]
> > So I agree with Pablo's suggestion: printing old/new short hash on
> > success would help visualy confirming something worked.
> 
> I think we have the machinery for this (see --update-refs=print for
> git-replay, for example), but I'm surprised to learn that we don't
> accept --update-refs=print for history.
> 
> In any case, I second the "we should emit something"—I wonder what, though.
> 
> - In the case of rewritten refs, we might like to emit the list of
> rewrites, a bit like a fetch or push will do: "+ $old...$new $ref
> (forced update)" or something
> - For new objects that aren't pointed to… maybe silence is a better
> indicator that "we didn't do what you intended"? Or we could just
> print the new commit objects "$new [unreferenced object]" or something

That's exactly my issue, as well. I'm slightly in favor of not writing
anything, but if we're able to figure out how exactly to represent
results to users in a nice and consistent way then I'm very happy to
change my opinion.

But that definitely needs to account not only for the case where the
current HEAD gets rewritten, but it needs to account for any reference
(including detached HEAD) that may be updated along the way.

> > ... But it might be worth to ensure that the commit has any ref we can
> > handle (if --update-refs is set then the commit we edit is ancestor to
> > some branch, if not set then it must be an ancestor of HEAD)
> >
> > What do you think?
> 
> I don't think it's worth restricting the operation (I can imagine a
> use case where someone creates an unpointed-to object and later makes
> the ref, even if that's a bit weird), but
> 
> - we could have a "strict" mode that ensured inputs are pointed to
> - we could warn when only unreferenced objects are rewritten
> 
> ? I see git-history as very "porcelain"/user-focused, so I think it's
> feasible to add output niceties (and optionally a quiet mode to
> suppress the messages).

Yeah, I don't see any issue with having such a "strict" mode, either.
But I definitely don't want to enforce "arbitrary" restrictions that
require the user to work around them. It's intentional that you can
rewrite history of commits that aren't even reachable from HEAD.

It might be sensible to even make the strict mode the default, where you
need to pass a switch to rewrite commits that are not reachable from
HEAD. But if so, we need to have a switch that disables this mode.

Patrick

  reply	other threads:[~2026-07-08 12:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 20:07 [PATCH RFC 0/2] builtin/history: change git history reword behavior and feedback Pablo Sabater
2026-06-07 20:07 ` [PATCH RFC 1/2] builtin/history: abort reword on unchanged message Pablo Sabater
2026-06-08  9:30   ` Patrick Steinhardt
2026-06-08 10:52     ` Pablo Sabater
2026-06-08 12:16   ` Junio C Hamano
2026-06-08 16:44     ` Ben Knoble
2026-06-09 10:03       ` Pablo Sabater
2026-06-09 10:14     ` Pablo Sabater
2026-06-09 10:30       ` Kristoffer Haugsbakk
2026-06-09 13:21       ` Junio C Hamano
2026-06-09 15:51         ` Pablo Sabater
2026-06-08 16:37   ` Ben Knoble
2026-06-09  9:59     ` Pablo Sabater
2026-06-07 20:07 ` [PATCH RFC 2/2] builtin/history: print feedback after successful reword Pablo Sabater
2026-06-08  9:30   ` Patrick Steinhardt
2026-06-08 10:45     ` Pablo Sabater
2026-06-08 12:16   ` Junio C Hamano
2026-06-08 13:23     ` Pablo Sabater
2026-06-08 16:47       ` Ben Knoble
2026-07-07  5:09         ` Dominique Martinet
2026-07-07 16:10           ` D. Ben Knoble
2026-07-08 12:04             ` Patrick Steinhardt [this message]
2026-06-09 10:42 ` [PATCH RFC v2 0/2] builtin/history: abort reword on same message Pablo Sabater
2026-06-09 10:42   ` [PATCH RFC v2 1/2] builtin/history: refactor function signature Pablo Sabater
2026-06-09 10:42   ` [PATCH RFC v2 2/2] builtin/history: abort reword on same message Pablo Sabater
2026-06-09 13:25     ` Phillip Wood
2026-06-09 16:20       ` Junio C Hamano
2026-06-09 17:12         ` Pablo Sabater
2026-06-09 19:17           ` Junio C Hamano
2026-06-10  7:03             ` Patrick Steinhardt
2026-06-10  9:33               ` Phillip Wood
2026-06-10 16:02               ` Junio C Hamano
2026-06-09 18:02         ` Justin Tobler
2026-06-09 19:30           ` Junio C Hamano
2026-06-09 20:14             ` Justin Tobler
2026-06-10  9:24         ` Phillip Wood

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=ak484Ywk97k-8ULs@pks.im \
    --to=ps@pks.im \
    --cc=asmadeus@codewreck.org \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=pabloosabaterr@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