git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Caleb White <cdwhite3@pm.me>
Date
Oct 8, 2024, 15:53 UTC
Message-ID
<r4zmcET41Skr_FMop47AKd7cms9E8bKPSvHuAUpnYavzKEY6JybJta0_7GfuYB0q-gD-XNcvh5VDTfiT3qthGKjqhS1sbT4M2lUABynOz2Q=@pm.me>
In-Reply-To
<20241008153035.71178-1-cdwhite3@pm.me>
On Tuesday, October 8th, 2024 at 10:30, Caleb White <cdwhite3@pm.me> wrote:
Show 25 quoted lines
> 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
Previous: Caleb White
Message 2 of 2 in “Re: [PATCH] worktree: repair copied repository and linked worktrees”
  1. Caleb WhiteOct 8, 2024
  2. Caleb WhiteOct 8, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.