public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail•com>
To: Matt Hunter <m@lfurio•us>, git@vger•kernel.org
Cc: Johannes Sixt <j6t@kdbg•org>
Subject: Re: [PATCH] revision: fix --left/right-only use with unrelated histories
Date: Sun, 30 Mar 2025 11:11:54 +0100	[thread overview]
Message-ID: <f8a7d089-3150-4212-8ad0-c9bbb3858776@gmail.com> (raw)
In-Reply-To: <20250330055809.1019090-1-m@lfurio.us>

Hi Matt

On 30/03/2025 06:49, Matt Hunter wrote:
> +test_expect_success 'rev-list one-sided unrelated symmetric diff' '
> +	test_tick &&
> +	git commit --allow-empty -m xyz &&
> +	git branch cmp &&
> +	git rebase --force-rebase --root &&
> +
> +	git rev-list --left-only  HEAD...cmp >head &&
> +	git rev-list --right-only HEAD...cmp >cmp  &&
> +
> +	test $(comm -12 <(sort head) <(sort cmp) | wc -l) = "0"

Thank you for adding a test. We have a helper function test_line_count 
which provides a helpful debugging message if the comparison fails. 
Using that and avoiding process substitutions we'd write

	sort head >sorted_head &&
	sort cmp >sorted_cmp &&
	comm -12 sorted_head sorted_cmp >actual &&
	test_line_count = 0 actual

Thanks

Phillip

> +
>   test_done
> 
> base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e


  parent reply	other threads:[~2025-03-30 10:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-30  5:49 [PATCH] revision: fix --left/right-only use with unrelated histories Matt Hunter
2025-03-30  8:31 ` Johannes Sixt
2025-04-01  9:56   ` Junio C Hamano
2025-03-30 10:11 ` Phillip Wood [this message]
2025-03-30 10:54   ` Matt Hunter
2025-04-02 13:12     ` phillip.wood123
2025-04-04  5:13       ` Matt Hunter
2025-03-30 11:24 ` [PATCH v2] " Matt Hunter
2025-04-11 14:41   ` 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=f8a7d089-3150-4212-8ad0-c9bbb3858776@gmail.com \
    --to=phillip.wood123@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=m@lfurio$(echo .)us \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /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