Re: [PATCH] revision: fix --left/right-only use with unrelated histories
- From
Matt Hunter <m@lfurio.us>
- Date
- Mar 30, 2025, 10:54 UTC
- Message-ID
- <D8TJMUMOGLBC.3FR8DHTTUN4M9@lfurio.us>
- In-Reply-To
- <f8a7d089-3150-4212-8ad0-c9bbb3858776@gmail.com>
On Sun Mar 30, 2025 at 6:11 AM EDT, Phillip Wood wrote:
Show 8 quoted lines
> 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 for that helper tip. I was just about to send a v2 when your message came in, so I'm getting that incorporated now.
By the way, I had originally wanted to write test assertions that checked the actual number of commit ids returned from each of the two calls to rev-list - something like:
git rev-list --X-only HEAD...cmp >file &&
test_line_count = N fileBut since I'm not very familiar with this test harness yet, I couldn't actually figure the correct value for N. It's not 1 (the commit made in my test body), and it's not 2 (that commit, plus the one from the setup case at the top of the file). Any appropriate higher value wasn't obvious.
So I switched to what you saw in my v1. Maybe this "no commit ids in common" test is actually the stronger assertion?