Re: [PATCH v2 3/5] worktree: add tests for worktrees with relative paths

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

 



On Mon, Oct 28, 2024 at 07:09:52PM +0000, Caleb White wrote:
> This patch expands the test coverage by adding cases that specifically
> handle relative paths. These tests verify correct behavior in a variety
> of operations, including: adding, listing, pruning, moving, and
> repairing worktrees with relative paths configured.
>
> This also adds a test case for reinitializing a repository that has
> relative worktrees.
>
> Signed-off-by: Caleb White <cdwhite3@xxxxx>
> ---
>  t/t0001-init.sh            | 17 +++++++++++++----
>  t/t2400-worktree-add.sh    | 41 +++++++++++++++++++++++++++++++++++++++++
>  t/t2401-worktree-prune.sh  |  3 ++-
>  t/t2402-worktree-list.sh   | 22 ++++++++++++++++++++++
>  t/t2403-worktree-move.sh   | 22 ++++++++++++++++++++++
>  t/t2406-worktree-repair.sh | 26 ++++++++++++++++++++++++++
>  6 files changed, 126 insertions(+), 5 deletions(-)
>
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index 0178aa62a41f1606f2382a4a10ab593ccf11e0e8..e21b9aa5e7f4599af8b20165b50896c9a49ba7ea 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -435,6 +435,7 @@ sep_git_dir_worktree ()  {
>  	test_when_finished "rm -rf mainwt linkwt seprepo" &&
>  	git init mainwt &&
>  	test_commit -C mainwt gumby &&
> +	git -C mainwt config worktree.useRelativePaths "$([ "$2" = "relative" ] && echo true || echo false)" &&

Can we avoid using '[' and perhaps split this out a little further.
Perhaps:

    if test "relative" = $2
    then
        git -C mainwt config worktree.useRelativePaths true
    else
        git -C mainwt config worktree.useRelativePaths false
    fi

I think the duplication is more than worth the clarity here.

Thanks,
Taylor




[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