From: Patrick Steinhardt <ps@pks.im>
To: Pablo Sabater <pabloosabaterr@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] builtin/history: implement "drop" subcommand
Date: Wed, 3 Jun 2026 12:06:19 +0200 [thread overview]
Message-ID: <ah_8myzMQJ97Y0n0@pks.im> (raw)
In-Reply-To: <CAN5EUNQbSN7+SDWcrh3jTD7SXrnD=e-fQ9Qj9778R7cy2q4b1g@mail.gmail.com>
On Tue, Jun 02, 2026 at 09:31:17AM +0200, Pablo Sabater wrote:
> El mar, 2 jun 2026 a las 8:16, Patrick Steinhardt (<ps@pks.im>) escribió:
[snip]
> > + original = lookup_commit_reference_by_name(argv[0]);
> > + if (!original) {
> > + ret = error(_("commit cannot be found: %s"), argv[0]);
> > + goto out;
> > + }
> > +
> > + if (!original->parents) {
> > + ret = error(_("cannot drop root commit %s: "
> > + "it has no parent to replay onto"),
> > + argv[0]);
> > + goto out;
> > + } else if (original->parents->next) {
> > + ret = error(_("cannot drop merge commit"));
>
> Why the if block adds which commit context, but not on the else if block?
True indeed, will adapt.
> > diff --git a/t/t3454-history-drop.sh b/t/t3454-history-drop.sh
> > new file mode 100755
> > index 0000000000..b320ff09b3
> > --- /dev/null
> > +++ b/t/t3454-history-drop.sh
> > @@ -0,0 +1,513 @@
> > +#!/bin/sh
> > +
> > +test_description='tests for git-history drop subcommand'
> > +
> > +. ./test-lib.sh
> > +. "$TEST_DIRECTORY/lib-log-graph.sh"
> > +
> > +expect_graph () {
> > + cat >expect &&
> > + lib_test_cmp_graph --graph --format=%s "$@"
> > +}
>
> This function appears exactly the same at t6016 and t4215 but named as
> check_graph. I was gonna do a cleanup for a commit series I'm working
> on to bring that function to `lib-log-graph.sh` because all these test
> files share that they import graph functions from `lib-log-graph.c`,
> maybe you could do it?
I'd rather keep this series focussed, but I wouldn't mind a follow up
that deduplicates these call sites.
> Also:
>
> lib_test_cmp_graph () {
> git log --graph "$@" >output &&
> sed 's/ *$//' >output.sanitized <output &&
> test_cmp expect output.sanitized
> }
>
> Already uses `--graph` you can drop it from expect_graph()
True indeed, dropped the "--graph" argument.
Thanks!
Patrick
next prev parent reply other threads:[~2026-06-03 10:06 UTC|newest]
Thread overview: 23+ 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 [this message]
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-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-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-03 23:58 ` Junio C Hamano
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=ah_8myzMQJ97Y0n0@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--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