github - Github 语言统计中未排除的路径

标签 github github-linguist

我已经阅读了相关的 SO 线程 herehere ,以及 Github 语言学家 manual override ,但我似乎无法从语言统计中排除一些顶级目录。

在当前的最新版本中,this repo显示了 HTML 代码的优势。单击 HTML 详细信息,会列出两个 HTML 文件:

  • 包/NUnit.2.5.7.10213/NUnitFitTests.html
    最后索引于 2016 年 12 月 30 日。
  • 包/NUnit.2.5.7.10213/Tools/NUnitFitTests.html
    最后索引于 2016 年 12 月 30 日。

  • 但那些应该是 .gitattributes 中排除路径的一部分:
    .nuget/* linguist-vendored
    libs/* linguist-vendored
    NUnit.Runners.2.6.4/* linguist-vendored
    packages/* linguist-vendored             §§ <--- this one in particular
    RubyInstallationFiles/* linguist-vendored
    

    但是在同一个详情页中,左下角的排名清楚地显示了 HTML 在较低的位置,而 C# 则位于顶部:

    enter image description here

    我究竟做错了什么?

    附带问题:在众多更改中,我还删除了 .gitattribute 文件中的注释,因为我无法从任何引用中找到这些注释是否允许或什么。有谁知道你是否可以在那里发表评论?哪种格式?助教

    最佳答案

    您可以使用 git-check-attr 检查属性并验证它们是否按照您认为的方式设置。

    $ git check-attr --all -- packages/NUnit.2.5.7.10213/NUnitFitTests.html
    $
    

    好像没有属性。问题似乎是 packages/*不是递归的。
    $ git check-attr --all -- packages/NUnit.2.5.7.10213/
    packages/NUnit.2.5.7.10213/: linguist-vendored: set
    

    那么模式的规则是什么?与 gitignore 相同.

    The rules how the pattern matches paths are the same as in .gitignore files; see gitignore(5). Unlike .gitignore, negative patterns are forbidden.



    您要找的是/** .

    A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.



    把那个修复...
    $ cat .gitattributes 
    .nuget/** linguist-vendored
    libs/** linguist-vendored
    NUnit.Runners.2.6.4/** linguist-vendored
    packages/** linguist-vendored
    RubyInstallationFiles/** linguist-vendored
    

    现在我们很好。
    $ git check-attr --all packages/NUnit.2.5.7.10213/NUnitFitTests.html
    packages/NUnit.2.5.7.10213/NUnitFitTests.html: linguist-vendored: set
    

    这也回答了你关于评论的问题......

    A line starting with # serves as a comment. Put a backslash ("\") in front of the first hash for patterns that begin with a hash.

    关于github - Github 语言统计中未排除的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42544813/

    相关文章:

    git - 是否可以在 GitHub 存储库上定义自己的语法?

    github - GitHub 是否考虑将 .mailmap 用于贡献图

    svn - 错误跟踪器/版本控制集成如何与典型的 git 工作流程一起工作?

    github - 压缩、 rebase 、重置 --soft 如何影响 github 贡献页面?

    javascript - 如何重新触发 GitHub 的语法荧光笔、Linguist?

    git - 在 .gitattributes 文件中添加多种语言

    github-api - github 是否为语言学家公开了 API?

    git - 如何配置 TeamCity 构建代理以使用 git 和 git ://protocol over a SOCKS proxy?

    java - 在服务器上发布gradle android库

    GitHub 重写标记语言?