Re: [PATCH v2 3/5] worktree: add tests for worktrees with relative paths
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 29, 2024, 23:00 UTC
- Message-ID
- <ZyFo+e5Vj2TpXNyo@nand.local>
- In-Reply-To
- <20241028-wt_relative_options-v2-3-33a5021bd7bb@pm.me>
On Mon, Oct 28, 2024 at 07:09:52PM +0000, Caleb White wrote:
Show 27 quoted lines
> 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@pm.me>
> ---
> 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
fiI think the duplication is more than worth the clarity here.
Thanks, Taylor