Skip to content

Conversation

@noahfraiture
Copy link

This PR aims to fix the git.PlainOpenWithOptions when opening a worktree. Previously the err "no reference found" were returned.

Copilot AI review requested due to automatic review settings September 28, 2025 10:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the git.PlainOpenWithOptions function to properly handle worktrees by enabling the use of the dotGitCommonDir filesystem when a worktree's commondir file is detected, even when EnableDotGitCommonDir is not explicitly set in options.

  • Modifies the condition for using dotgit.NewRepositoryFilesystem to check for both the option flag and the presence of a common directory
  • Moves the dotGitCommon variable declaration to be available regardless of the option setting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pjbgf
Copy link
Member

pjbgf commented Sep 29, 2025

@noahfraiture please add a test to confirm the behaviour your are trying to fix so that we can avoid future regressions.

@pjbgf
Copy link
Member

pjbgf commented Oct 27, 2025

I'm not sure we need this change. Users can reach the same outcome by using PlainOpenWithOptions("/repo", &PlainOpenOptions{EnableDotGitCommonDir: true}).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants