]> git.ipfire.org Git - thirdparty/git.git/commit - git-add--interactive.perl
git add -i: Fix parsing of abbreviated hunk headers
authorJean-Luc Herren <jlh@gmx.ch>
Tue, 9 Oct 2007 19:29:26 +0000 (21:29 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 16 Oct 2007 01:00:40 +0000 (21:00 -0400)
commit7288ed8ebdab54e5aa05400bd840e1348ffdc270
tree496b5544169427bcba7674d1fbab20bba17d29be
parenta72c874e43e89a879fc4a8998ecd6e5a56667929
git add -i: Fix parsing of abbreviated hunk headers

The unified diff format allows one-line ranges to be abbreviated
by omiting the size.  The hunk header "@@ -10,1 +10,1 @@" can be
expressed as "@@ -10 +10 @@", but this wasn't properly parsed in
all cases.

Such abbreviated hunk headers are generated when a one-line change
(add, remove or modify) appears without context; for example
because the file is a one-liner itself or because GIT_DIFF_OPTS
was set to '-u0'.  If the user then runs 'git add -i' and enters
the 'patch' command for that file, perl complains about undefined
variables.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-add--interactive.perl