Re: [PATCH v5 1/2] merge-tree.c: add --merge-base=<commit> option
On Thu, Nov 03 2022, Kyle Zhao via GitGitGadget wrote:
> From: Kyle Zhao <kylezhao@tencent.com>
> [...]
> +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
Show 5 quoted lines
> + 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) &&
Show 12 quoted lines
> +
> + 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