豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Deploying NuGetGallery locally changes bootstrap.min.css line endings from CRLF to LF #10472

@japarson

Description

@japarson

Deploying the NuGetGallery locally from VS results in a bootstrap.min.css file modification even if the file hasn't been changed. This is somewhat annoying as I have to constantly work around the modified css file when staging changes.

PS C:\git\NuGetGallery> git config core.autocrlf
true

On checkout we have CRLF line endings in the working directory:

PS C:\git\NuGetGallery> git ls-files --eol
...
i/lf    w/crlf  attr/text=auto          src/NuGetGallery/Content/gallery/css/bootstrap.min.css
...

After deploying the line endings are now LF:

PS C:\git\NuGetGallery> git ls-files --eol
...
i/lf    w/lf    attr/text=auto          src/NuGetGallery/Content/gallery/css/bootstrap.min.css
...

Examining the diff:

PS C:\git\NuGetGallery> git diff HEAD --no-ext-diff --patch-with-raw -z --no-color -- .\src\NuGetGallery\Content\gallery\css\bootstrap.min.css
warning: in the working copy of 'src/NuGetGallery/Content/gallery/css/bootstrap.min.css', LF will be replaced by CRLF the next time Git touches it

I suspect the reason the line endings are changing has something to do with style rendering that bundles the minified css files:

@Styles.Render("~/Content/gallery/css/site.min.css")
@Styles.Render("~/Content/gallery/css/bootstrap.min.css")

One solution that I think would work is to prevent git from modifying line endings for the bootstrap.min.cs file by adding this line to .gitattributes:

*.min.css -text

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions