Thread (2 messages) 2 messages, 1 author, 2024-10-08

Re: [PATCH] worktree: repair copied repository and linked worktrees

From: Caleb White <hidden>
Date: 2024-10-08 15:53:53

On Tuesday, October 8th, 2024 at 10:30, Caleb White [off-list ref] wrote:
test_expect_success 'does not repair worktrees from another repo' '
test_when_finished "rm -rf repo1 repo2" &&
mkdir -p repo1 &&
git -C repo1 init main &&
test_commit -C repo1/main nothing &&
git -C repo1/main worktree add ../linked &&
cp repo1/main/.git/worktrees/linked/gitdir repo1/main.expect &&
cp repo1/linked/.git repo1/linked.expect &&
mkdir -p repo2 &&
git -C repo2 init main &&
test_commit -C repo2/main nothing &&
git -C repo2/main worktree add ../linked &&
cp repo2/main/.git/worktrees/linked/gitdir repo2/main.expect &&
cp repo2/linked/.git repo2/linked.expect &&
git -C repo1/main worktree repair ../.. &&
test_cmp repo1/main.expect repo1/main/.git/worktrees/linked/gitdir &&
test_cmp repo1/linked.expect repo1/linked/.git &&
test_cmp repo2/main.expect repo2/main/.git/worktrees/linked/gitdir &&
test_cmp repo2/linked.expect repo2/linked/.git &&
git -C repo2/main worktree repair ../../repo1/linked &&
test_cmp repo1/main.expect repo1/main/.git/worktrees/linked/gitdir &&
test_cmp repo1/linked.expect repo1/linked/.git &&
test_cmp repo2/main.expect repo2/main/.git/worktrees/linked/gitdir &&
test_cmp repo2/linked.expect repo2/linked/.git
'
Apologies on this test case, it should be:

    test_expect_success 'does not repair worktrees from another repo' '
	test_when_finished "rm -rf repo1 repo2" &&
	mkdir -p repo1 &&
	git -C repo1 init main &&
	test_commit -C repo1/main nothing &&
	git -C repo1/main worktree add ../linked &&
	cp repo1/main/.git/worktrees/linked/gitdir repo1/main.expect &&
	cp repo1/linked/.git repo1/linked.expect &&
	mkdir -p repo2 &&
	git -C repo2 init main &&
	test_commit -C repo2/main nothing &&
	git -C repo2/main worktree add ../linked &&
	cp repo2/main/.git/worktrees/linked/gitdir repo2/main.expect &&
	cp repo2/linked/.git repo2/linked.expect &&
	git -C repo1/main worktree repair ../../repo2/linked &&
	test_cmp repo1/main.expect repo1/main/.git/worktrees/linked/gitdir &&
	test_cmp repo1/linked.expect repo1/linked/.git &&
	test_cmp repo2/main.expect repo2/main/.git/worktrees/linked/gitdir &&
	test_cmp repo2/linked.expect repo2/linked/.git &&
	git -C repo2/main worktree repair ../../repo1/linked &&
	test_cmp repo1/main.expect repo1/main/.git/worktrees/linked/gitdir &&
	test_cmp repo1/linked.expect repo1/linked/.git &&
	test_cmp repo2/main.expect repo2/main/.git/worktrees/linked/gitdir &&
	test_cmp repo2/linked.expect repo2/linked/.git
    '

- Caleb

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help