{"thread":{"id":"55734","subject":"Fw: Tabs vs Spaces - Handle like CLRF?","startedAt":"2021-05-19T15:55:53Z","lastAt":"2021-05-19T16:29:02Z","messageCount":2,"participants":["James Hughes","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"424969","messageId":"GJHGZLcAwaihWwWmzAt8bdOKWi8JiupQxVUXCs1FwKTOmn2yvWEjI8DDTmDaBA48lzz4pGQ-JmwmHKSrEU2NCpdyxXW-ExqZcgxKEmL-454=@pyrosoftsolutions.co.uk","threadId":"55734","inReplyTo":"2AzjQ7QDayLsqCbYQzwoZhJvvWKVAlBXStsOtYN03i41hVJcbYou0Je8Sxqec8UB0j0ZAfhKosA_IymlTez2X1J-voxUfG65EA-Zm0YWU10=@pyrosoftsolutions.co.uk","subject":"Fw: Tabs vs Spaces - Handle like CLRF?","fromName":"James Hughes","fromEmail":"james@pyrosoftsolutions.co.uk","sentAt":"2021-05-19T15:55:46Z","receivedAt":"2021-05-19T15:55:53Z","isPatch":false,"sender":{"key":"james@pyrosoftsolutions.co.uk","avatar":null},"body":"Hi all,\n\nWe have the ability to automagically handle CLRF issues when we commit and check-out to handle different dev environments.\n\nA lot of us will also hold religious beliefs as to which is the correct way to indent, tabs or spaces.\n\nSince it's simple a whitespacing issue, is there any reason we couldn't handle this in a similar way to CLRF? Give devs the choice to commit with tabs/spaces as per their organisations requirements and then convert to their preference on checkout?\n\nAll the best,\n\nJames\n\n"},{"id":"424972","messageId":"YKU8yMIO8uSuIYZh@coredump.intra.peff.net","threadId":"55734","inReplyTo":"GJHGZLcAwaihWwWmzAt8bdOKWi8JiupQxVUXCs1FwKTOmn2yvWEjI8DDTmDaBA48lzz4pGQ-JmwmHKSrEU2NCpdyxXW-ExqZcgxKEmL-454=@pyrosoftsolutions.co.uk","subject":"Re: Fw: Tabs vs Spaces - Handle like CLRF?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-05-19T16:28:56Z","receivedAt":"2021-05-19T16:29:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 19, 2021 at 03:55:46PM +0000, James Hughes wrote:\n\n> We have the ability to automagically handle CLRF issues when we commit\n> and check-out to handle different dev environments.\n> \n> A lot of us will also hold religious beliefs as to which is the\n> correct way to indent, tabs or spaces.\n> \n> Since it's simple a whitespacing issue, is there any reason we\n> couldn't handle this in a similar way to CLRF? Give devs the choice to\n> commit with tabs/spaces as per their organisations requirements and\n> then convert to their preference on checkout?\n\nYou can. See clean/smudge filters in the gitattributes(5) manpage. You'd\ndeclare one of them the canonical in-repo format (let's say tabs). Then\nyour \"clean\" filter would convert spaces-to-tabs, perhaps with something\nlike \"perl -pe 's/ {8}/\\t/g'\". And your \"smudge\" filter would convert\ntabs back to spaces.\n\nAnd then you just mark the files you want converted with an attribute in\n.gitattributes, and wire up that attribute to the filters in your\nconfig.\n\n-Peff\n"}]}