Allow one-line hunks in --diff #127

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

encukou commented Oct 1, 2012

In Git diff, hunks containing only one line in either the original
or modified file do not have the number of lines specified.
Without this patch, pep8 crashes on a diff with such a hunk.

For example, this would fail in pep8's repository:
git show 6ff543b -U0 | pep8 --diff

The -U0 option is useful to only check new code, not anything that
surrounds it. The bug can also appear without -U0 in one-line files.

@encukou encukou Allow one-line hunks in --diff
In Git diff, hunks containing only one line in either the original
or modified file do not have the number of lines specified.
Without this patch, pep8 crashes on a diff with such a hunk.

For example, this would fail in pep8's repository:
    git show 6ff543b -U0 | pep8 --diff

The -U0 option is useful to only check new code, not anything that
surrounds it. The bug can also appear without -U0, in one-line files.
541efdc

@gthb gthb referenced this pull request in gthb/pep8 Nov 8, 2012

@gthb gthb Fix --diff failing on one-line hunks
Without this fix, pep8 --diff fails uncleanly on diff hunks where either
the old or the new hunk is just one line and the patch omits the `,1`

Compact fix for jcrocholl#127
3a275ec
Contributor

florentx commented Dec 9, 2012

Thank you, fixed in issue #137

florentx closed this Dec 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment