From: Ævar Arnfjörð Bjarmason Date: Thu, 03 Nov 2022 08:36:38 GMT Subject: Re: [PATCH v5 1/2] merge-tree.c: add --merge-base= option Message-ID: <221103.868rks301x.gmgdl@evledraar.gmail.com> In-Reply-To: <01df0d1a6a7319beada3a3a94b8e36818be2a4d2.1667446182.git.gitgitgadget@gmail.com> On Thu, Nov 03 2022, Kyle Zhao via GitGitGadget wrote: > From: Kyle Zhao > [...] > +test_expect_success 'specify merge-base as parent of branch2' ' > + # Setup > + git init base-b2-p && ( It's good practice to nuke it after the test: test_when_finished "rm -rf base-b2-p" && git init base-b2-p > + cd base-b2-p && > + test_commit c1 file1 && > + test_commit c2 file2 && > + test_commit c3 file3 > + ) && Could avoid the subshell-ing with: test_commit -C base-b2-p c1 file1 && [...] > + # Testing > + ( > + cd base-b2-p && > + TREE_OID=$(git merge-tree --write-tree --merge-base=c2 c1 c3) && Ditto sub-shell. > + > + q_to_tab <<-EOF >expect && > + 100644 blob $(git rev-parse c1:file1)Qfile1 > + 100644 blob $(git rev-parse c3:file3)Qfile3 > + EOF > + > + git ls-tree $TREE_OID >actual && > + test_cmp expect actual > + ) > +' > + > test_done