{"thread":{"id":"57166","subject":"Git Diff feature request","startedAt":"2021-12-30T11:33:14Z","lastAt":"2022-01-03T10:14:40Z","messageCount":5,"participants":["Nick Gearls","rsbecker@nexbridge.com","Erik Cervin Edin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"445218","messageId":"52591f5d-d4b5-90ea-e84e-32b99803a3e6@gmail.com","threadId":"57166","inReplyTo":null,"subject":"Git Diff feature request","fromName":"Nick Gearls","fromEmail":"nickgearls@gmail.com","sentAt":"2021-12-30T11:33:09Z","receivedAt":"2021-12-30T11:33:14Z","isPatch":false,"sender":{"key":"nickgearls@gmail.com","avatar":null},"body":"On top of the option ignore-all-space, it would be very handy (for \nseveral programming languages) to have an additional option \nignore-all-space-and-eol where the following snippets would be equivalent:\n\nif (...) a = 1\n\nif (...)\n    a = 1\n\nThanks\n"},{"id":"445219","messageId":"00dd01d7fd78$7e69e150$7b3da3f0$@nexbridge.com","threadId":"57166","inReplyTo":"52591f5d-d4b5-90ea-e84e-32b99803a3e6@gmail.com","subject":"RE: Git Diff feature request","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2021-12-30T12:26:33Z","receivedAt":"2021-12-30T12:26:42Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On December 30, 2021 6:33 AM, Nick Gearls wrote:\n> On top of the option ignore-all-space, it would be very handy (for several\n> programming languages) to have an additional option ignore-all-space-and-\n> eol where the following snippets would be equivalent:\n> \n> if (...) a = 1\n> \n> if (...)\n>     a = 1\n\nOne interesting technique I have seen used is to set up a pre-commit hook and/or clean filter to format code according to corporate/team standards. Reprocessing code prior to the commit would allow a normalization of coding standards and removing of EOL or space/tab concerns. So even if a developer did\n\nif (...) a= 1\n\nBy the time it reaches the repo, it looks like\n\nif (...)\n    a = 1\n\nWe use a similar technique (enforced only by policy right now, not a hook), which is to require code to run through standard IDE source formatting. Improperly formatted code hitting pull requests gets a decline until the code is properly formatted. A pull request diff might not include an above suggested diff option.\n\n--Randall\n\n"},{"id":"445286","messageId":"CA+JQ7M_tQG4yzSeHjZxPWuWEOM=iSLrWxojQGcpL9E7FcoXLRg@mail.gmail.com","threadId":"57166","inReplyTo":"00dd01d7fd78$7e69e150$7b3da3f0$@nexbridge.com","subject":"Re: Git Diff feature request","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2021-12-31T11:15:32Z","receivedAt":"2021-12-31T11:16:10Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"On Fri, Dec 31, 2021 at 11:23 AM <rsbecker@nexbridge.com> wrote:\n> One interesting technique I have seen used is to set up a pre-commit hook and/or clean filter to format code according to corporate/team standards. Reprocessing code prior to the commit would allow a normalization of coding standards and removing of EOL or space/tab concerns.\n> ...\n> We use a similar technique (enforced only by policy right now, not a hook), which is to require code to run through standard IDE source formatting. Improperly formatted code hitting pull requests gets a decline until the code is properly formatted.\n\nI agree with Randall, the easiest solution is to adhere to a formatting standard\n"},{"id":"445343","messageId":"e3e2cf38-31e0-7b3e-af79-88226dcdabe5@gmail.com","threadId":"57166","inReplyTo":"CA+JQ7M_tQG4yzSeHjZxPWuWEOM=iSLrWxojQGcpL9E7FcoXLRg@mail.gmail.com","subject":"Re: Git Diff feature request","fromName":"Nick Gearls","fromEmail":"nickgearls@gmail.com","sentAt":"2022-01-03T07:53:53Z","receivedAt":"2022-01-03T07:53:57Z","isPatch":false,"sender":{"key":"nickgearls@gmail.com","avatar":null},"body":"When you want to compare 2 versions of a repo you don't own, you don't \nhave the option to apply a formatting standard ...\n\nOn 31-12-2021 12:15, Erik Cervin Edin wrote:\n> On Fri, Dec 31, 2021 at 11:23 AM<rsbecker@nexbridge.com>  wrote:\n>> One interesting technique I have seen used is to set up a pre-commit hook and/or clean filter to format code according to corporate/team standards. Reprocessing code prior to the commit would allow a normalization of coding standards and removing of EOL or space/tab concerns.\n>> ...\n>> We use a similar technique (enforced only by policy right now, not a hook), which is to require code to run through standard IDE source formatting. Improperly formatted code hitting pull requests gets a decline until the code is properly formatted.\n> I agree with Randall, the easiest solution is to adhere to a formatting standard\n\n"},{"id":"445346","messageId":"CA+JQ7M-3sswuYzuXy+bs=e26o3btDoK9z3A0j4WVvELoHG5A-Q@mail.gmail.com","threadId":"57166","inReplyTo":"83d398ce-caba-34f7-3727-3e7f5d396127@gmail.com","subject":"Re: Git Diff feature request","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-01-03T10:14:02Z","receivedAt":"2022-01-03T10:14:40Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"On Mon, Jan 3, 2022 at 8:43 AM Nick Gearls <nickgearls@gmail.com> wrote:\n>\n> When you want to compare 2 versions of a repo you don't own, you don't have the option to apply a formatting standard ...\n\nYou may try\nhttps://git-scm.com/docs/diff-options#Documentation/diff-options.txt---word-diff-regexltregexgt\n\n  printf 'if (xyz) biz()\\n' > bar\n  git commit -m 1 bar\n  printf 'if (xyz)\\n  biz()\\n' > bar\n  git commit -m 2 bar\n  git diff --word-diff-regex='[^[:space:]]' HEAD~\n\nyields a diff with differences hidden\n\ndiff --git a/bar b/bar\nindex 49d380e..05c8e60 100644\n--- a/bar\n+++ b/bar\n@@ -1 +1,2 @@\nif (xyz)\n  biz()\n\nBut from gits perspective, the files are different and the lines are different.\nThis is the reason having an adhering to a formatting standard is advised,\nand something IMHO every serious project should adhere to.\n"}]}