From: Junio C Hamano Date: Wed, 23 Apr 2025 20:58:51 +0000 (-0700) Subject: Merge branch 'mh/left-right-limited' X-Git-Tag: v2.50.0-rc0~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=477209bd7fb1605d10be7c8eae9d215e265b4501;p=thirdparty%2Fgit.git Merge branch 'mh/left-right-limited' "git log --{left,right}-only A...B", when A and B does not share any common ancestor, now behaves as expected. * mh/left-right-limited: revision: fix --left/right-only use with unrelated histories --- 477209bd7fb1605d10be7c8eae9d215e265b4501 diff --cc t/t6000-rev-list-misc.sh index 33881274a4,d338f7ecb4..fec16448cf --- a/t/t6000-rev-list-misc.sh +++ b/t/t6000-rev-list-misc.sh @@@ -182,55 -182,19 +182,70 @@@ test_expect_success 'rev-list --unpacke test_cmp expect actual ' + 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 && + + sort head >head.sorted && + sort cmp >cmp.sorted && + comm -12 head.sorted cmp.sorted >actual && + test_line_count = 0 actual + ' + +test_expect_success 'rev-list -z' ' + test_when_finished rm -rf repo && + + git init repo && + test_commit -C repo 1 && + test_commit -C repo 2 && + + oid1=$(git -C repo rev-parse HEAD~) && + oid2=$(git -C repo rev-parse HEAD) && + + printf "%s\0%s\0" "$oid2" "$oid1" >expect && + git -C repo rev-list -z HEAD >actual && + + test_cmp expect actual +' + +test_expect_success 'rev-list -z --objects' ' + test_when_finished rm -rf repo && + + git init repo && + test_commit -C repo 1 && + test_commit -C repo 2 && + + oid1=$(git -C repo rev-parse HEAD:1.t) && + oid2=$(git -C repo rev-parse HEAD:2.t) && + path1=1.t && + path2=2.t && + + printf "%s\0path=%s\0%s\0path=%s\0" "$oid1" "$path1" "$oid2" "$path2" \ + >expect && + git -C repo rev-list -z --objects HEAD:1.t HEAD:2.t >actual && + + test_cmp expect actual +' + +test_expect_success 'rev-list -z --boundary' ' + test_when_finished rm -rf repo && + + git init repo && + test_commit -C repo 1 && + test_commit -C repo 2 && + + oid1=$(git -C repo rev-parse HEAD~) && + oid2=$(git -C repo rev-parse HEAD) && + + printf "%s\0%s\0boundary=yes\0" "$oid2" "$oid1" >expect && + git -C repo rev-list -z --boundary HEAD~.. >actual && + + test_cmp expect actual +' + test_done