Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused field: Repository.real #1936

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions libs/git/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ var GitDirectoryName = ".git"
// Repository represents a Git repository or a directory
// that could later be initialized as Git repository.
type Repository struct {
// real indicates if this is a real repository or a non-Git
// directory where we process .gitignore files.
real bool

// rootDir is the path to the root of the repository checkout.
// This can be either the main repository checkout or a worktree checkout.
// For more information about worktrees, see: https://git-scm.com/docs/git-worktree#_description.
Expand Down Expand Up @@ -209,15 +205,13 @@ func (r *Repository) Ignore(relPath string) (bool, error) {
}

func NewRepository(path vfs.Path) (*Repository, error) {
real := true
rootDir, err := vfs.FindLeafInTree(path, GitDirectoryName)
if err != nil {
if !errors.Is(err, fs.ErrNotExist) {
return nil, err
}
// Cannot find `.git` directory.
// Treat the specified path as a potential repository root checkout.
real = false
rootDir = path
}

Expand All @@ -229,7 +223,6 @@ func NewRepository(path vfs.Path) (*Repository, error) {
}

repo := &Repository{
real: real,
rootDir: rootDir,
gitDir: gitDir,
gitCommonDir: gitCommonDir,
Expand Down
Loading