On Fri, Nov 25, 2016 at 7:24 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote: > Adding the test for the failed parse_ref() is possible, I think. But > since that function is destined to die, as I promised to use > refs-provided api instead of rolling out a custom ref parser, and I'm > going to have another hard look at refs subsystem for the > gc-not-looking-at-worktree-refs problem, may I make another promise to > add tests after this function is gone? Never mind. I went ahead and made a test case anyway because why not. But that's not worth an email. An interesting thing maybe worth sharing is, if HEAD is broken (the only reason we would fail to create "struct worktree" for main worktree), then "git worktree list" from main worktree would fail too, because repo setup code fails to parse HEAD as well and die(). That makes the "always show main worktree" patch useless, since we won't get far enough to execute get_worktrees() in the first place. However, you can still do "git worktree list" from a linked worktree, gitdir setup code will not stop you (how can it). And the patch is still needed. -- Duy