294
`clean` command is used to convert the contents of worktree file
295
upon checkin.
296
297
-A missing filter driver definition in the config is not an error
298
-but makes the filter a no-op passthru.
299
-
300
-The content filtering is done to massage the content into a
301
-shape that is more convenient for the platform, filesystem, and
302
-the user to use. The key phrase here is "more convenient" and not
303
-"turning something unusable into usable". In other words, the
304
-intent is that if someone unsets the filter driver definition,
305
-or does not have the appropriate filter program, the project
306
-should still be usable.
297
+One use of the content filtering is to massage the content into a shape
298
+that is more convenient for the platform, filesystem, and the user to use.
299
+For this mode of operation, the key phrase here is "more convenient" and
300
+not "turning something unusable into usable". In other words, the intent
301
+is that if someone unsets the filter driver definition, or does not have
302
+the appropriate filter program, the project should still be usable.
303
+
304
+Another use of the content filtering is to store the content that cannot
305
+be directly used in the repository (e.g. a UUID that refers to the true
306
+content stored outside git, or an encrypted content) and turn it into a
307
+usable form upon checkout (e.g. download the external content, or decrypt
308
+the encrypted content).
309
+
310
+These two filters behave differently, and by default, a filter is taken as
311
+the former, massaging the contents into more convenient shape. A missing
312
+filter driver definition in the config, or a filter driver that exits with
313
+a non-zero status, is not an error but makes the filter a no-op passthru.
314
+
315
+You can declare that a filter turns a content that by itself is unusable
316
+into a usable content by setting the filter.<driver>.required configuration
317
+variable to `true`.
318
319
For example, in .gitattributes, you would assign the `filter`
320
attribute for paths.
346
smudge filter means that the clean filter _must_ accept its own output
347
without modifying it.
348
349
+If a filter _must_ succeed in order to make the stored contents usable,
350
+you can declare that the filter is `required`, in the configuration:
351
+
352
+------------------------
353
+[filter "crypt"]
354
+ clean = openssl enc ...
355
+ smudge = openssl enc -d ...
356
+ required
357
+------------------------
358
+
359
Sequence "%f" on the filter command line is replaced with the name of
360
the file the filter is working on. A filter might use this in keyword
361
substitution. For example: