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

git gui: fix staging a second line to a 1-line file #359

Closed
wants to merge 1 commit into from

Conversation

dscho
Copy link
Member

@dscho dscho commented Sep 26, 2019

Yet another patch that is carried in Git for Windows for quite a long time. This fixes git-for-windows#515.

This commit was contributed as https://github.com/patthoyts/git/gui/pull/7 which was ignored for almost three years, and then as prati0100/git-gui#1 which was rejected in favor of a mailing list-centric workflow.

The patch is based on Git GUI's master branch at https://github.com/prati0100/git-gui/.

Cc: Pratyush Yadav me@yadavpratyush.com

When a 1-line file is augmented by a second line, and the user tries to
stage that single line via the "Stage Line" context menu item, we do not
want to see "apply: corrupt patch at line 5".

The reason for this error was that the hunk header looks like this:

	@@ -1 +1,2 @@

but the existing code expects the original range always to contain a
comma. This problem is easily fixed by cutting the string "1 +1,2"
(that Git GUI formerly mistook for the starting line) at the space.

This fixes git-for-windows#515

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member Author

dscho commented Sep 26, 2019

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Sep 26, 2019

Submitted as pull.359.git.gitgitgadget@gmail.com

lib/diff.tcl Show resolved Hide resolved
@dscho
Copy link
Member Author

dscho commented Sep 26, 2019

This was already applied and backported.

@dscho dscho closed this Sep 26, 2019
@dscho dscho deleted the git-gui-stage-line branch September 26, 2019 21:06
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.

1 participant