Git Diff feature request

4 messages, 3 authors, 2022-01-03 · open the first message on its own page

Git Diff feature request

From: Nick Gearls <hidden>
Date: 2021-12-30 11:33:14

On top of the option ignore-all-space, it would be very handy (for 
several programming languages) to have an additional option 
ignore-all-space-and-eol where the following snippets would be equivalent:

if (...) a = 1

if (...)
    a = 1

Thanks

RE: Git Diff feature request

From: <hidden>
Date: 2021-12-30 12:26:42

On December 30, 2021 6:33 AM, Nick Gearls wrote:
On top of the option ignore-all-space, it would be very handy (for several
programming languages) to have an additional option ignore-all-space-and-
eol where the following snippets would be equivalent:

if (...) a = 1

if (...)
    a = 1
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. So even if a developer did

if (...) a= 1

By the time it reaches the repo, it looks like

if (...)
    a = 1

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. A pull request diff might not include an above suggested diff option.

--Randall

Re: Git Diff feature request

From: Erik Cervin Edin <hidden>
Date: 2021-12-31 11:16:10

On Fri, Dec 31, 2021 at 11:23 AM [off-list ref] wrote:
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.
...
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.
I agree with Randall, the easiest solution is to adhere to a formatting standard

Re: Git Diff feature request

From: Nick Gearls <hidden>
Date: 2022-01-03 07:53:57

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 ...

On 31-12-2021 12:15, Erik Cervin Edin wrote:
On Fri, Dec 31, 2021 at 11:23 AM[off-list ref]  wrote:
quoted
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.
...
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.
I agree with Randall, the easiest solution is to adhere to a formatting standard

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help