public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail•com>
To: "Patrick Steinhardt" <ps@pks•im>, git@vger•kernel.org
Cc: "Junio C Hamano" <gitster@pobox•com>,
	"D. Ben Knoble" <ben.knoble@gmail•com>
Subject: Re: [PATCH v2 3/5] builtin/history: replace "--ref-action=print" with "--dry-run"
Date: Fri, 13 Feb 2026 18:30:10 +0100	[thread overview]
Message-ID: <315801b6-bc9e-42b4-8356-12fd8b83223c@app.fastmail.com> (raw)
In-Reply-To: <20260213-b4-pks-history-dry-run-v2-3-756ac376e9e5@pks.im>

On Fri, Feb 13, 2026, at 10:12, Patrick Steinhardt wrote:
> The git-history(1) command has the ability to perform a dry-run
> that will not end up modifying any references. Instead, we'll only print
> any ref updates that would happen as a consequence of performing the
> operation.
>
> This mode is somewhat hidden though behind the "--ref-action=print"
> option. This command line option has its origin in git-replay(1), where
> it's probably an okayish interface as this command is sitting more on
> the plumbing side of tools. But git-history(1) is a user-facing tool,
> and this way of achieving a dry-run is way too technical and thus not
> very discoverable.

It makes sense to use this command as a dry run and then pass the output
on to git-update-ref(1) for the wet run.

    git history --dry-run ... | git update-ref --stdin

Looks good.

>
> Besides usability issues, it also has another issue: the dry-run mode
> will always operate as if the user wanted to rewrite all branches. But
> in fact, the user also has the option to only update the HEAD reference,
> and they might want to perform a dry-run of such an operation, too. We
> could of course introduce "--ref-actoin=print-head", but that would

s/--ref-actoin/--ref-action/

> become even less ergonomic.
>
> Replace "--ref-action=print" with a new "--dry-run" toggle. This new
> toggle works with both "--ref-action={head,branches}" and is way more
> discoverable.
>
> Add a test to verify that both "--ref-action=" values behave as
> expected.
>
> This patch is best viewed with "--ignore-space-change".
>
> Signed-off-by: Patrick Steinhardt <ps@pks•im>
> ---
>[snip]
> +`--ref-action=(branches|head)`::
>  	Control which references will be updated by the command, if any. With
>  	`branches`, all local branches that point to commits which are
>  	descendants of the original commit will be rewritten. With `head`, only
> -	the current `HEAD` reference will be rewritten. With `print`, all
> -	updates as they would be performed with `branches` are printed in a
> -	format that can be consumed by linkgit:git-update-ref[1].
> +	the current `HEAD` reference will be rewritten.

`HEAD` is mentioned here because it could be detached `HEAD`. So you
can’t just say the current branch.

“the current `HEAD` reference” seems a bit much. Is this less precise?

     only `HEAD` is rewritten.

>
>  GIT
>  ---
>[snip]

  reply	other threads:[~2026-02-13 17:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 12:44 [PATCH 0/4] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-12 12:44 ` [PATCH 1/4] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-12 20:04   ` Junio C Hamano
2026-02-13  5:51     ` Patrick Steinhardt
2026-02-13 17:02       ` Junio C Hamano
2026-02-12 12:44 ` [PATCH 2/4] builtin/history: check for merges " Patrick Steinhardt
2026-02-12 22:20   ` D. Ben Knoble
2026-02-12 22:26     ` Junio C Hamano
2026-02-13  5:51       ` Patrick Steinhardt
2026-02-13  5:51     ` Patrick Steinhardt
2026-02-13 13:42       ` Ben Knoble
2026-02-12 12:44 ` [PATCH 3/4] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-12 20:19   ` Junio C Hamano
2026-02-13  5:50     ` Patrick Steinhardt
2026-02-12 22:20   ` D. Ben Knoble
2026-02-13  5:50     ` Patrick Steinhardt
2026-02-12 12:44 ` [PATCH 4/4] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-13  9:12 ` [PATCH v2 0/5] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-13  9:12   ` [PATCH v2 1/5] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-13 17:20     ` Junio C Hamano
2026-02-13  9:12   ` [PATCH v2 2/5] builtin/history: check for merges " Patrick Steinhardt
2026-02-13  9:12   ` [PATCH v2 3/5] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-13 17:30     ` Kristoffer Haugsbakk [this message]
2026-02-16  6:39       ` Patrick Steinhardt
2026-02-18 16:09         ` Kristoffer Haugsbakk
2026-02-13  9:12   ` [PATCH v2 4/5] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-13  9:12   ` [PATCH v2 5/5] Documentation/git-history: document default for "--update-refs=" Patrick Steinhardt
2026-02-13 17:21     ` Junio C Hamano
2026-02-16  6:45 ` [PATCH v3 0/5] builtin/history: some smaller UI improvements Patrick Steinhardt
2026-02-16  6:45   ` [PATCH v3 1/5] builtin/history: perform revwalk checks before asking for user input Patrick Steinhardt
2026-02-16  6:45   ` [PATCH v3 2/5] builtin/history: check for merges " Patrick Steinhardt
2026-02-16  6:45   ` [PATCH v3 3/5] builtin/history: replace "--ref-action=print" with "--dry-run" Patrick Steinhardt
2026-02-16  6:45   ` [PATCH v3 4/5] builtin/history: rename "--ref-action=" to "--update-refs=" Patrick Steinhardt
2026-02-16  6:45   ` [PATCH v3 5/5] Documentation/git-history: document default for "--update-refs=" 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=315801b6-bc9e-42b4-8356-12fd8b83223c@app.fastmail.com \
    --to=kristofferhaugsbakk@fastmail$(echo .)com \
    --cc=ben.knoble@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=ps@pks$(echo .)im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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