Allow using .git directory instead of gitdir redirect in submodules. by crummel · Pull Request #653 · dotnet/sourcelink (original) (raw)

Choose a reason for hiding this comment

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

A test is failing - looking at it I think we should keep throwing if the file can't be read, rather then returning null.

var gitDirectory = Directory.Exists(dotGitPath) ? dotGitPath : ReadDotGitFile(dotGitPath);

if (!IsGitDirectory(gitDirectory, out var commonDirectory)) { return null; }

Choose a reason for hiding this comment

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

With this change you'd still need to update the Submodules_Errors test - remove case S6:

[submodule ""S6""]             # sub6/.git is a directory, but should be a file
  path = sub6
  url = http://github.com

Choose a reason for hiding this comment

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

Or rather update it - since in this case the directory is not a valid git directory (it's empty) so failure is expected of some sort