From: Junio C Hamano Date: Wed, 03 Jun 2026 23:51:47 GMT Subject: Re: [PATCH v2 5/9] reset: introduce ability to skip reference updates Message-ID: In-Reply-To: <20260603-b4-pks-history-drop-v2-5-742cb5b5176d@pks.im> Patrick Steinhardt writes: > @@ -112,6 +113,9 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts) > if (opts->branch_msg && !opts->branch) > BUG("branch reflog message given without a branch"); > > + if (skip_ref_updates && (opts->branch || refs_only)) > + BUG("asked to perform ref updates and skip them at the same time"); ;-) That's certainly a careful safety valve. Would we also want to catch skip_ref_updates && update_orig_head being both set as a bogus request? > if (!refs_only && !dry_run && repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0) { > ret = -1; > goto leave_reset_head; > @@ -196,7 +200,8 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts) > goto leave_reset_head; > } > > - if (oid != &head_oid || update_orig_head || switch_to_branch) > + if (!skip_ref_updates && > + (oid != &head_oid || update_orig_head || switch_to_branch)) > ret = update_refs(r, opts, oid, head); > > leave_reset_head: > diff --git a/reset.h b/reset.h > index 9f696382c1..cb0700ffa7 100644 > --- a/reset.h > +++ b/reset.h > @@ -27,6 +27,9 @@ enum reset_head_flags { > * any user-visible state. > */ > RESET_HEAD_DRY_RUN = (1 << 5), > + > + /* Skip updating any references, only update the worktree and index. */ > + RESET_HEAD_SKIP_REF_UPDATES = (1 << 6), > }; > > struct reset_head_opts {