Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, Pablo Sabater <pabloosabaterr@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 5/9] reset: introduce ability to skip reference updates
Date: Wed, 10 Jun 2026 09:31:46 +0200	[thread overview]
Message-ID: <aikS4huB4Qe9tEa4@pks.im> (raw)
In-Reply-To: <b9055227-f6e8-452d-928c-d944ad840f31@gmail.com>

On Tue, Jun 09, 2026 at 11:03:24AM +0100, Phillip Wood wrote:
> Hi Patrick
> 
> On 08/06/2026 10:18, Patrick Steinhardt wrote:
> > On Mon, Jun 08, 2026 at 11:14:08AM +0200, Patrick Steinhardt wrote:
> > > On Fri, Jun 05, 2026 at 04:12:42PM +0100, Phillip Wood wrote:
> > > > Hi Patrick
> > > > 
> > > > On 03/06/2026 17:14, Patrick Steinhardt wrote:
> > > > > In a subsequent commit we'll introduce a new caller to `reset_head()`
> > > > > that really only wants to update the index and working tree, without
> > > > > updating any references. Introduce a new flag that lets the caller
> > > > > perform this operation.
> > > > 
> > > > We already have a flag to update ORIG_HEAD so would it make more sense to
> > > > have a flag to update HEAD, rather than adding a flag to disable the
> > > > updates? It would mean updating the existing callers but I think it is a
> > > > clearer api and it avoids the pitfall of
> > > > 
> > > > 	RESET_HEAD_ORIG_HEAD | RESET_HEAD_SKIP_REF_UPDATES
> > > 
> > > Hm. The question is whether it's sensible to have
> > > `!RESET_HEAD_UPDATE_HEAD && RESET_HEAD_UPDATE_ORIG_HEAD`. That feels
> > > like a somewhat weird request, too, and we'd have to introduce extra
> > > logic to make that combination work.
> 
> As there are no users at the moment we could make that a BUG() and implement
> it later if required. At least that way we're not introducing conflicting
> flags, we're just not implementing setting a certain combination of refs.

Hm, okay, I'll have a look at this.

> > > > I wonder about the function name as well if we make updating HEAD optional
> > > > then what does reset_head() mean? Maybe we should rename it something along
> > > > the lines of reset_worktree() or update_working_copy()? I'm not really sure
> > > > what a good name would be.
> > > 
> > > That's a good point, the name does get somewhat awkward. I think we
> > > should keep "reset" in there, but `reset_worktree()` to me reads as it
> > > if was rather related to git-worktree(1) than anything else. Maybe
> > > `reset_working_tree()`?
> > 
> > I think I'll skip these changes for the next iteration for now. The
> > patch series has already exploded quite a bit in its scope due to the
> > refactorings of `reset_head()`, so I'd prefer to maybe do such changes
> > as a follow up.
> 
> Renaming the function can certainly wait. I'd quite like to sort out the
> flags though as the new flag is being added in this series.

If we introduce RESET_HEAD_UPDATE_HEAD I'd also like to rename so that
there's not a silent new caller where we don't have the new flag.

Patrick

  reply	other threads:[~2026-06-10  7:31 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 15:36 [PATCH 0/2] builtin/history: introduce "drop" subcommand Patrick Steinhardt
2026-06-01 15:36 ` [PATCH 1/2] builtin/history: split handling of ref updates into two phases Patrick Steinhardt
2026-06-01 15:36 ` [PATCH 2/2] builtin/history: implement "drop" subcommand Patrick Steinhardt
2026-06-01 23:43   ` Junio C Hamano
2026-06-03 10:06     ` Patrick Steinhardt
2026-06-02  7:31   ` Pablo Sabater
2026-06-03 10:06     ` Patrick Steinhardt
2026-06-03 16:13 ` [PATCH v2 0/9] builtin/history: introduce " Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 1/9] read-cache: split out function to drop unmerged entries to stage 0 Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 2/9] reset: drop `USE_THE_REPOSITORY_VARIABLE` Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 3/9] reset: modernize flags passed to `reset_head()` Patrick Steinhardt
2026-06-03 18:01     ` Kristoffer Haugsbakk
2026-06-05 15:08     ` Phillip Wood
2026-06-08  9:14       ` Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 4/9] reset: introduce dry-run mode Patrick Steinhardt
2026-06-03 18:18     ` Kristoffer Haugsbakk
2026-06-03 23:49     ` Junio C Hamano
2026-06-03 16:14   ` [PATCH v2 5/9] reset: introduce ability to skip reference updates Patrick Steinhardt
2026-06-03 23:51     ` Junio C Hamano
2026-06-04  9:01       ` Patrick Steinhardt
2026-06-05 15:12     ` Phillip Wood
2026-06-08  9:14       ` Patrick Steinhardt
2026-06-08  9:18         ` Patrick Steinhardt
2026-06-09 10:03           ` Phillip Wood
2026-06-10  7:31             ` Patrick Steinhardt [this message]
2026-06-03 16:14   ` [PATCH v2 6/9] reset: allow the caller to specify the current HEAD object Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 7/9] reset: stop assuming that the caller passes in a clean index Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 8/9] builtin/history: split handling of ref updates into two phases Patrick Steinhardt
2026-06-03 16:14   ` [PATCH v2 9/9] builtin/history: implement "drop" subcommand Patrick Steinhardt
2026-06-03 19:04     ` Kristoffer Haugsbakk
2026-06-04  9:02       ` Patrick Steinhardt
2026-06-03 23:58     ` Junio C Hamano
2026-06-04  9:02       ` Patrick Steinhardt
2026-06-08 10:23 ` [PATCH v3 0/9] builtin/history: introduce " Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 1/9] read-cache: split out function to drop unmerged entries to stage 0 Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 2/9] reset: drop `USE_THE_REPOSITORY_VARIABLE` Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 3/9] reset: modernize flags passed to `reset_head()` Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 4/9] reset: introduce dry-run mode Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 5/9] reset: introduce ability to skip reference updates Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 6/9] reset: allow the caller to specify the current HEAD object Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 7/9] reset: stop assuming that the caller passes in a clean index Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 8/9] builtin/history: split handling of ref updates into two phases Patrick Steinhardt
2026-06-08 10:23   ` [PATCH v3 9/9] builtin/history: implement "drop" subcommand Patrick Steinhardt
2026-06-10  8:52 ` [PATCH v4 00/10] builtin/history: introduce " Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 01/10] read-cache: split out function to drop unmerged entries to stage 0 Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 02/10] reset: drop `USE_THE_REPOSITORY_VARIABLE` Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 03/10] reset: rename `reset_head()` Patrick Steinhardt
2026-06-10 13:10     ` Phillip Wood
2026-06-10  8:52   ` [PATCH v4 04/10] reset: modernize flags passed to `reset_working_tree()` Patrick Steinhardt
2026-06-10 13:10     ` Phillip Wood
2026-06-10  8:52   ` [PATCH v4 05/10] reset: introduce dry-run mode Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 06/10] reset: introduce ability to skip updating HEAD Patrick Steinhardt
2026-06-10 13:11     ` Phillip Wood
2026-06-10  8:52   ` [PATCH v4 07/10] reset: allow the caller to specify the current HEAD object Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 08/10] reset: stop assuming that the caller passes in a clean index Patrick Steinhardt
2026-06-10  8:52   ` [PATCH v4 09/10] builtin/history: split handling of ref updates into two phases Patrick Steinhardt
2026-06-10 16:25     ` Junio C Hamano
2026-06-10  8:52   ` [PATCH v4 10/10] builtin/history: implement "drop" subcommand Patrick Steinhardt

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=aikS4huB4Qe9tEa4@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pabloosabaterr@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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