dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.02k stars 854 forks source link

Extracted metadata source.remote.repo only working for git remote "origin" #5547

Open jldubz opened 4 years ago

jldubz commented 4 years ago

Operation System: (Windows or Linux or MacOS) Windows

DocFX Version Used: 2.49.0.0

Template used: (default or statictoc or contain custom template) default, material

Steps to Reproduce:

  1. Configure a project with a git configuration using a remote named anything other than "origin" (I used "github" for this example
  2. Setup docfx to point to that project, __gitContribute metadata doesn't seem to make a difference
  3. run docfx metadata -f

Expected Behavior: DocFX properly generates metadata and identifies a repository from the list of configured repos in the .git/config file. Optimally it would be nice to be able to specify the exact remote to use for generating the source details per managed reference; something like a global metadata tag, maybe an extension to _gitUrlPattern and make the current flag a part of it IE

"_gitUrlPattern": {
    "type": "github",
    "remoteName": "github"
}

Actual Behavior:

A flood of warning messages in the console log for every item in the project and incomplete metadata:

...
[20-02-20 09:50:19.404]Warning:[ExtractMetadata]Skipping GetFileDetail. Exception found: Microsoft.DocAsCode.Common.Git.GitException, Message:
[20-02-20 09:50:19.497]Warning:[ExtractMetadata]Skipping GetFileDetail. Exception found: Microsoft.DocAsCode.Common.Git.GitException, Message:
...
KalleOlaviNiemitalo commented 4 years ago

The "origin" name is hardcoded here in v2: https://github.com/dotnet/docfx/blob/d8f389f391d31dcc0b943fb5bf58077441a23dbf/src/Microsoft.DocAsCode.Common/Git/GitUtility.cs#L35-L36

and in v3: https://github.com/dotnet/docfx/blob/7481cc74b0968d13599ebae986996795040ea281/src/docfx/lib/git/GitUtility.cs#L71-L75