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>

Lars Schneider committed Dec 18, 2016 at 20:01 UTC 862f9312b3c910e5c8df6f96591fd3565d5a64ee
2 files changed +14 -14
git-p4.py
+2 -2
@@ -1098,10 +1098,10 @@ class GitLFS(LargeFileSystem):
1098 '# Git LFS (see https://git-lfs.github.com/)\n',
1099 '#\n',
1100 ] +
1101 - ['*.' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
1101 + ['*.' + f.replace(' ', '[[:space:]]') + ' filter=lfs diff=lfs merge=lfs -text\n'
1102 for f in sorted(gitConfigList('git-p4.largeFileExtensions'))
1103 ] +
1104 - ['/' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
1104 + ['/' + f.replace(' ', '[[:space:]]') + ' filter=lfs diff=lfs merge=lfs -text\n'
1105 for f in sorted(self.largeFiles) if not self.hasLargeFileExtension(f)
1106 ]
1107 )
t/t9824-git-p4-git-lfs.sh
+12 -12
@@ -81,9 +81,9 @@ test_expect_success 'Store files in LFS based on size (>24 bytes)' '
81 #
82 # Git LFS (see https://git-lfs.github.com/)
83 #
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
87 EOF
88 test_path_is_file .gitattributes &&
89 test_cmp expect .gitattributes
@@ -109,7 +109,7 @@ test_expect_success 'Store files in LFS based on size (>25 bytes)' '
109 #
110 # Git LFS (see https://git-lfs.github.com/)
111 #
112 - /file4.bin filter=lfs -text
112 + /file4.bin filter=lfs diff=lfs merge=lfs -text
113 EOF
114 test_path_is_file .gitattributes &&
115 test_cmp expect .gitattributes
@@ -135,7 +135,7 @@ test_expect_success 'Store files in LFS based on extension (dat)' '
135 #
136 # Git LFS (see https://git-lfs.github.com/)
137 #
138 - *.dat filter=lfs -text
138 + *.dat filter=lfs diff=lfs merge=lfs -text
139 EOF
140 test_path_is_file .gitattributes &&
141 test_cmp expect .gitattributes
@@ -163,8 +163,8 @@ test_expect_success 'Store files in LFS based on size (>25 bytes) and extension
163 #
164 # Git LFS (see https://git-lfs.github.com/)
165 #
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
168 EOF
169 test_path_is_file .gitattributes &&
170 test_cmp expect .gitattributes
@@ -199,8 +199,8 @@ test_expect_success 'Remove file from repo and store files in LFS based on size
199 #
200 # Git LFS (see https://git-lfs.github.com/)
201 #
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
204 EOF
205 test_path_is_file .gitattributes &&
206 test_cmp expect .gitattributes
@@ -237,8 +237,8 @@ test_expect_success 'Add .gitattributes and store files in LFS based on size (>2
237 #
238 # Git LFS (see https://git-lfs.github.com/)
239 #
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
242 EOF
243 test_path_is_file .gitattributes &&
244 test_cmp expect .gitattributes
@@ -278,7 +278,7 @@ test_expect_success 'Add big files to repo and store files in LFS based on compr
278 #
279 # Git LFS (see https://git-lfs.github.com/)
280 #
281 - /file6.bin filter=lfs -text
281 + /file6.bin filter=lfs diff=lfs merge=lfs -text
282 EOF
283 test_path_is_file .gitattributes &&
284 test_cmp expect .gitattributes