Re: [PATCH] revision: fix --left/right-only use with unrelated histories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux