Skip to content

Commit 24d018e

Browse files
committed
build: prevent eol modification in vendored code
When 'dep ensure -vendor-only' is run, dep will update the dependencies in the vendor directory to match what's referenced in Gopkg.lock. It does this without performing EOL modification. Even if there are no changes to the dependencies, this shows up as pending changes in tree. ``` Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: vendor/github.com/Knetic/govaluate/LICENSE modified: vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE ``` When you run `git diff` to see the changes, warnings like the following are issued: ``` warning: CRLF will be replaced by LF in vendor/github.com/Knetic/govaluate/LICENSE. The file will have its original line endings in your working directory. ``` This is telling us that when we add the changes to the index, git will convert the CRLF to LF leaving is with no changes in the index and nothing to commit. We can prevent this confusion by disabling the automatic text conversion for files in the vendor folder. This change disables text conversion for vendor/** and re-adds the files with CRLF from our vendor tree. Signed-off-by: Matthew Sykes <[email protected]>
1 parent a53a796 commit 24d018e

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
*.yml text eol=lf
1717
*.zip binary
1818
LICENSE text eol=lf
19+
vendor/** -text

vendor/github.com/Knetic/govaluate/LICENSE

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)