Re: [PATCH v5 06/10] reset: introduce ability to skip updating HEAD
On Thu, Jun 11, 2026 at 11:00:25AM -0700, Junio C Hamano wrote:
Show 33 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Note that in a previous iteration we instead introduced a flag that made
> > callers opt out of updating any references. This was somewhat awkward
> > though because we already have the `UPDATE_ORIG_HEAD` flag, so the
> > result was somewhat inconsistent.
> >
> > Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > builtin/rebase.c | 14 ++++++++++----
> > reset.c | 9 +++++++--
> > reset.h | 9 ++++++---
> > sequencer.c | 4 +++-
> > 4 files changed, 26 insertions(+), 10 deletions(-)
> >
> > diff --git a/reset.c b/reset.c
> > ...
> > @@ -129,7 +133,7 @@ int reset_working_tree(struct repository *r,
> > oid = &head_oid;
> >
> > if (refs_only) {
> > - if (!dry_run)
> > + if (update_head)
> > return update_refs(r, opts, oid, head);
> > return 0;
> > }
>
> So when refs_only and update-head are in effect, we will call
> update_refs(), even if dry_run is given. update_refs() does not
> seem to pay attention to (opts->flags & RESET_WORKING_TREE_DRY_RUN)
> at all, so wouldn't this mean that we would update even in a dry-run
> session?Ugh, good catch, this is obviously wrong. Will fix.
Patrick