Skip to content

Commit 862f931

Browse files
larsxschneidergitster
authored andcommitted
git-p4: add diff/merge properties to .gitattributes for GitLFS files
The `git lfs track` command generates a .gitattributes file with diff and merge properties [1]. Set the same .gitattributes format for files tracked with GitLFS in git-p4. [1] https://github.com/git-lfs/git-lfs/blob/v1.5.3/commands/command_track.go#L121 Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 82f2567 commit 862f931

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

git-p4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,10 @@ def generateGitAttributes(self):
10981098
'# Git LFS (see https://git-lfs.github.com/)\n',
10991099
'#\n',
11001100
] +
1101-
['*.' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
1101+
['*.' + f.replace(' ', '[[:space:]]') + ' filter=lfs diff=lfs merge=lfs -text\n'
11021102
for f in sorted(gitConfigList('git-p4.largeFileExtensions'))
11031103
] +
1104-
['/' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
1104+
['/' + f.replace(' ', '[[:space:]]') + ' filter=lfs diff=lfs merge=lfs -text\n'
11051105
for f in sorted(self.largeFiles) if not self.hasLargeFileExtension(f)
11061106
]
11071107
)

t/t9824-git-p4-git-lfs.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ test_expect_success 'Store files in LFS based on size (>24 bytes)' '
8181
#
8282
# Git LFS (see https://git-lfs.github.com/)
8383
#
84-
/file2.dat filter=lfs -text
85-
/file4.bin filter=lfs -text
86-
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text
84+
/file2.dat filter=lfs diff=lfs merge=lfs -text
85+
/file4.bin filter=lfs diff=lfs merge=lfs -text
86+
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs diff=lfs merge=lfs -text
8787
EOF
8888
test_path_is_file .gitattributes &&
8989
test_cmp expect .gitattributes
@@ -109,7 +109,7 @@ test_expect_success 'Store files in LFS based on size (>25 bytes)' '
109109
#
110110
# Git LFS (see https://git-lfs.github.com/)
111111
#
112-
/file4.bin filter=lfs -text
112+
/file4.bin filter=lfs diff=lfs merge=lfs -text
113113
EOF
114114
test_path_is_file .gitattributes &&
115115
test_cmp expect .gitattributes
@@ -135,7 +135,7 @@ test_expect_success 'Store files in LFS based on extension (dat)' '
135135
#
136136
# Git LFS (see https://git-lfs.github.com/)
137137
#
138-
*.dat filter=lfs -text
138+
*.dat filter=lfs diff=lfs merge=lfs -text
139139
EOF
140140
test_path_is_file .gitattributes &&
141141
test_cmp expect .gitattributes
@@ -163,8 +163,8 @@ test_expect_success 'Store files in LFS based on size (>25 bytes) and extension
163163
#
164164
# Git LFS (see https://git-lfs.github.com/)
165165
#
166-
*.dat filter=lfs -text
167-
/file4.bin filter=lfs -text
166+
*.dat filter=lfs diff=lfs merge=lfs -text
167+
/file4.bin filter=lfs diff=lfs merge=lfs -text
168168
EOF
169169
test_path_is_file .gitattributes &&
170170
test_cmp expect .gitattributes
@@ -199,8 +199,8 @@ test_expect_success 'Remove file from repo and store files in LFS based on size
199199
#
200200
# Git LFS (see https://git-lfs.github.com/)
201201
#
202-
/file2.dat filter=lfs -text
203-
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text
202+
/file2.dat filter=lfs diff=lfs merge=lfs -text
203+
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs diff=lfs merge=lfs -text
204204
EOF
205205
test_path_is_file .gitattributes &&
206206
test_cmp expect .gitattributes
@@ -237,8 +237,8 @@ test_expect_success 'Add .gitattributes and store files in LFS based on size (>2
237237
#
238238
# Git LFS (see https://git-lfs.github.com/)
239239
#
240-
/file2.dat filter=lfs -text
241-
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text
240+
/file2.dat filter=lfs diff=lfs merge=lfs -text
241+
/path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs diff=lfs merge=lfs -text
242242
EOF
243243
test_path_is_file .gitattributes &&
244244
test_cmp expect .gitattributes
@@ -278,7 +278,7 @@ test_expect_success 'Add big files to repo and store files in LFS based on compr
278278
#
279279
# Git LFS (see https://git-lfs.github.com/)
280280
#
281-
/file6.bin filter=lfs -text
281+
/file6.bin filter=lfs diff=lfs merge=lfs -text
282282
EOF
283283
test_path_is_file .gitattributes &&
284284
test_cmp expect .gitattributes

0 commit comments

Comments
 (0)