{"thread":{"id":"65591","subject":"Question on Clean/Smudge Infrastructure","startedAt":"2026-05-04T17:06:10Z","lastAt":"2026-05-05T15:04:37Z","messageCount":3,"participants":["rsbecker@nexbridge.com","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"542682","messageId":"079201dcdbe7$162d5430$4287fc90$@nexbridge.com","threadId":"65591","inReplyTo":null,"subject":"Question on Clean/Smudge Infrastructure","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2026-05-04T16:57:21Z","receivedAt":"2026-05-04T17:06:10Z","isPatch":false,"body":"Hi Git,\n\nI have a edge use case that I would like to ask about.\n\nGiven a directory with a large number, say 100, text files, and a few\nscattered\nbinary files - specified in .gitattributes as binary, what does clean smudge\ndo\nwith the binary files if they match the filter specification pattern? Are\nthey\nignored or processed. I am not sure that passing binary via stdin is\nnecessarily\nportable. However, I would like to be able to explicitly ignore the binary\nfiles\nin my clean/smudge filters - either by doing a copy stdin/stdout (as I said,\nprobably\nnot portable), or sending a non-zero exit code, or some other mechanism.\nThe root of the use case is that the directory is subject to significant\nchanges\nover time, and errors are sneaking in when people forget to update\n.gitattributes\nor name the files incorrectly. I would like to make their situation more\nstable\nto errors.\n\nThanks,\nRandall\n\n--\nBrief whoami: NonStop&UNIX developer since approximately\nUNIX(421664400)\nNonStop(211288444200000000)\n-- In real life, I talk too much.\n\n\n"},{"id":"542761","messageId":"xmqqzf2em2v8.fsf@gitster.g","threadId":"65591","inReplyTo":"079201dcdbe7$162d5430$4287fc90$@nexbridge.com","subject":"Re: Question on Clean/Smudge Infrastructure","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-05T12:56:27Z","receivedAt":"2026-05-05T12:56:29Z","isPatch":false,"body":"<rsbecker@nexbridge.com> writes:\n\n> Hi Git,\n>\n> I have a edge use case that I would like to ask about.\n>\n> Given a directory with a large number, say 100, text files, and a few\n> scattered\n> binary files - specified in .gitattributes as binary, what does clean smudge\n> do\n> with the binary files if they match the filter specification pattern? Are\n> they\n> ignored or processed. I am not sure that passing binary via stdin is\n> necessarily\n> portable. However, I would like to be able to explicitly ignore the binary\n> files\n> in my clean/smudge filters - either by doing a copy stdin/stdout (as I said,\n> probably\n> not portable), or sending a non-zero exit code, or some other mechanism.\n> The root of the use case is that the directory is subject to significant\n> changes\n> over time, and errors are sneaking in when people forget to update\n> .gitattributes\n> or name the files incorrectly. I would like to make their situation more\n> stable\n> to errors.\n>\n> Thanks,\n> Randall\n>\n> --\n> Brief whoami: NonStop&UNIX developer since approximately\n> UNIX(421664400)\n> NonStop(211288444200000000)\n> -- In real life, I talk too much.\n\n\n* Passing binary via stdin is perfetly normal.  Otherwise, it would\n  not work to set \"exif\" as the textconv filter on JPEG image files.\n\n* The \"filter\" attribute is orthogonal to other attributes like\n  \"text\" or \"diff\".  If \"filter\" somehow paid attention to\n  binary-ness of the payload and refrained from working at all, then\n  it would make it impossible to filter binary contents.\n\n* If you want to apply your \"filter\" attribute to a subset of the\n  files you have, you need to sift your files into two classes, ones\n  that your filter would be used, and the other the remainder.  And\n  they give your filter attribute only to the former.  Perhaps you\n  only want *.txt to go through clean/smudge, and then you would\n  have \n\n    *.txt filter=mytextfilter\n\n  in your .gitattributes, and in your .git/config, you would have\n  lines to speicify the executable you can use on each system.\n\n   [filter \"mytextfilter\"]\n\tclean = ... your system specific command comes here ...\n\tsmudge = ... your system specific command comes here ...\n\n"},{"id":"542762","messageId":"082601dcdca0$7bcb6e80$73624b80$@nexbridge.com","threadId":"65591","inReplyTo":"xmqqzf2em2v8.fsf@gitster.g","subject":"RE: Question on Clean/Smudge Infrastructure","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2026-05-05T15:04:28Z","receivedAt":"2026-05-05T15:04:37Z","isPatch":false,"body":"On May 5, 2026 8:56 AM, Junio C Hamano wrote:\n> <rsbecker@nexbridge.com> writes:\n> \n> > Hi Git,\n> >\n> > I have a edge use case that I would like to ask about.\n> >\n> > Given a directory with a large number, say 100, text files, and a few\n> > scattered binary files - specified in .gitattributes as binary, what\n> > does clean smudge do with the binary files if they match the filter\n> > specification pattern? Are they ignored or processed. I am not sure\n> > that passing binary via stdin is necessarily portable. However, I\n> > would like to be able to explicitly ignore the binary files in my\n> > clean/smudge filters - either by doing a copy stdin/stdout (as I said,\n> > probably not portable), or sending a non-zero exit code, or some other\n> > mechanism.\n> > The root of the use case is that the directory is subject to\n> > significant changes over time, and errors are sneaking in when people\n> > forget to update .gitattributes or name the files incorrectly. I would\n> > like to make their situation more stable to errors.\n> >\n> > Thanks,\n> > Randall\n> >\n> > --\n> > Brief whoami: NonStop&UNIX developer since approximately\n> > UNIX(421664400)\n> > NonStop(211288444200000000)\n> > -- In real life, I talk too much.\n> \n> \n> * Passing binary via stdin is perfetly normal.  Otherwise, it would\n>   not work to set \"exif\" as the textconv filter on JPEG image files.\n> \n> * The \"filter\" attribute is orthogonal to other attributes like\n>   \"text\" or \"diff\".  If \"filter\" somehow paid attention to\n>   binary-ness of the payload and refrained from working at all, then\n>   it would make it impossible to filter binary contents.\n> \n> * If you want to apply your \"filter\" attribute to a subset of the\n>   files you have, you need to sift your files into two classes, ones\n>   that your filter would be used, and the other the remainder.  And\n>   they give your filter attribute only to the former.  Perhaps you\n>   only want *.txt to go through clean/smudge, and then you would\n>   have\n> \n>     *.txt filter=mytextfilter\n> \n>   in your .gitattributes, and in your .git/config, you would have\n>   lines to speicify the executable you can use on each system.\n> \n>    [filter \"mytextfilter\"]\n> \tclean = ... your system specific command comes here ...\n> \tsmudge = ... your system specific command comes here ...\n\nThanks. I'm going to add a mechanism to auto-add file extensions\nfor this situation. That will allow me to select by pattern and\nimprove long-term manageability.\n\nRegards,\nRandall\n\n"}]}