Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

Fixed check for .git being a file or directory #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 4 additions & 3 deletions NGit/NGit/BaseRepositoryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,14 @@ protected internal virtual void SetupGitDir()
if (GetGitDir() == null && GetWorkTree() != null)
{
FilePath dotGit = new FilePath(GetWorkTree(), Constants.DOT_GIT);
if (!dotGit.IsFile())
//Don't use dotGit.IsFile() since it will return true on symlinks to directories
if (File.Exists(dotGit.GetAbsolutePath()))
{
SetGitDir(dotGit);
SetGitDir(GetSymRef(GetWorkTree(), dotGit));
}
else
{
SetGitDir(GetSymRef(GetWorkTree(), dotGit));
SetGitDir(dotGit);
}
}
}
Expand Down