Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow one-line hunks in --diff #127

Closed
wants to merge 1 commit into from
Closed

Conversation

encukou
Copy link

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

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.
gthb referenced this pull request in gthb/pep8 Nov 8, 2012
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
@florentx
Copy link
Contributor

florentx commented Dec 9, 2012

Thank you, fixed in issue #137

@florentx florentx closed this Dec 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants