Skip to content

Commit

Permalink
Only change root if .git is directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Oct 30, 2024
1 parent 7af6e78 commit 9b02929
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gitindex/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func openRepo(repoDir string) (*git.Repository, io.Closer, error) {
}

// If there's a .git directory, use that as the new root.
if _, err := fs.Stat(git.GitDirName); err == nil {
if fi, err := fs.Stat(git.GitDirName); err == nil && fi.IsDir() {
if fs, err = fs.Chroot(git.GitDirName); err != nil {
return nil, nil, fmt.Errorf("fs.Chroot: %w", err)
}
Expand Down

0 comments on commit 9b02929

Please sign in to comment.