Re: [PATCH v5 1/2] merge-tree.c: add --merge-base=<commit> option

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

 



On Thu, Nov 03 2022, Kyle Zhao via GitGitGadget wrote:

> From: Kyle Zhao <kylezhao@xxxxxxxxxxx>

> [...]
> +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




[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