Indentation in a patch

Started by Bernice Southey5 months ago3 messagesgeneral
Jump to latest
#1Bernice Southey
bernice.southey@gmail.com

Hi,
I'm having a fight with git and indentation for my first ever patch
attempt. I'm just adding an if statement around an existing 70-line
code-block. It's a very simple few lines with --ignore-all-space. But
the patch file is noisy because of 140 lines of +/- indentation diffs.

I then realised the standard was tabs, and after fixing my spaces,
things got even worse. The 140 lines now interleave in many unreadable
chunks. I've tried different diff-algorithms, but they make no
difference. I'm tempted to submit my patch without indenting the
if-block, and an explanation. Any better suggestions?

While I'm asking, I added a regression test and ran make check-world
with the TAP tests. Anything else I should do before sending it to
hackers?

Thanks, Bernice

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Bernice Southey (#1)
Re: Indentation in a patch

On 25 Nov 2025, at 19:14, Bernice Southey <bernice.southey@gmail.com> wrote:

.. for my first ever patch attempt.

Awesome, we love to see new contributors!

I'm tempted to submit my patch without indenting the
if-block, and an explanation.

That's perfectly fine, an incorrectly indentend diff is fine to submit if it
makes it more readable (especially when coupled with a note explaining why).

While I'm asking, I added a regression test and ran make check-world
with the TAP tests. Anything else I should do before sending it to
hackers?

Sounds like you've completed all the required steps.

--
Daniel Gustafsson

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Daniel Gustafsson (#2)
Re: Indentation in a patch

On 25.11.25 19:58, Daniel Gustafsson wrote:

On 25 Nov 2025, at 19:14, Bernice Southey <bernice.southey@gmail.com> wrote:

.. for my first ever patch attempt.

Awesome, we love to see new contributors!

I'm tempted to submit my patch without indenting the
if-block, and an explanation.

That's perfectly fine, an incorrectly indentend diff is fine to submit if it
makes it more readable (especially when coupled with a note explaining why).

Alternatively or additionally, git diff -w/--ignore-all-space can be
useful in situations like this.