Skip to content

Commit 56bd3c8

Browse files
committed
Merge pull request git-lfs#265 from github/update-track-attribs
add diff/merge properties to gitattributes
2 parents 97ef181 + 2aa1f7e commit 56bd3c8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

commands/command_track.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func trackCommand(cmd *cobra.Command, args []string) {
5858
continue
5959
}
6060

61-
_, err := attributesFile.WriteString(fmt.Sprintf("%s filter=lfs -crlf\n", t))
61+
_, err := attributesFile.WriteString(fmt.Sprintf("%s filter=lfs diff=lfs merge=lfs -crlf\n", t))
6262
if err != nil {
6363
Print("Error adding path %s", t)
6464
continue

commands/track_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ func TestTrackOnEmptyRepository(t *testing.T) {
5151
cmd.Before(func() {
5252
// write attributes file in .git
5353
path := filepath.Join(".gitattributes")
54-
repo.WriteFile(path, "*.mov filter=lfs -crlf\n")
54+
repo.WriteFile(path, "*.mov filter=lfs diff=lfs merge=lfs -crlf\n")
5555
})
5656

5757
cmd.After(func() {
5858
// assert path was added
59-
assert.Equal(t, "*.mov filter=lfs -crlf\n*.gif filter=lfs -crlf\n", repo.ReadFile(".gitattributes"))
59+
assert.Equal(t, "*.mov filter=lfs diff=lfs merge=lfs -crlf\n*.gif filter=lfs diff=lfs merge=lfs -crlf\n", repo.ReadFile(".gitattributes"))
6060

6161
expected := "Listing tracked paths\n *.mov (.gitattributes)\n *.gif (.gitattributes)\n"
6262

@@ -82,14 +82,12 @@ func TestTrackWithoutTrailingLinebreak(t *testing.T) {
8282
cmd.Output = "Tracking *.gif"
8383

8484
cmd.Before(func() {
85-
// write attributes file in .git
86-
path := filepath.Join(".gitattributes")
87-
repo.WriteFile(path, "*.mov filter=lfs -crlf")
85+
repo.WriteFile(".gitattributes", "*.mov filter=lfs -crlf")
8886
})
8987

9088
cmd.After(func() {
9189
// assert path was added
92-
assert.Equal(t, "*.mov filter=lfs -crlf\n*.gif filter=lfs -crlf\n", repo.ReadFile(".gitattributes"))
90+
assert.Equal(t, "*.mov filter=lfs -crlf\n*.gif filter=lfs diff=lfs merge=lfs -crlf\n", repo.ReadFile(".gitattributes"))
9391

9492
expected := "Listing tracked paths\n *.mov (.gitattributes)\n *.gif (.gitattributes)\n"
9593

0 commit comments

Comments
 (0)