author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 5 Sep 2008 04:46:56 +0000 (21:46 -0700) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 5 Sep 2008 04:52:56 +0000 (21:52 -0700) | ||
commit | ca53c3fdcf69f620331f3822cef36d95b5cf5640 | |
tree | ba6c889548b63cff874ab08332070e502b49a313 | tree | snapshot |
parent | 9dc3793166db8f3b80b909e2cb3ac3c5d0a611d5 | commit | diff |
git-gui: Fix diff parsing for lines starting with "--" or "++"
Languages like Lua and SQL use "--" to mark a line as commented out.
If this appears at column 0 and is part of the pre-image we may see
"--- foo" in the diff, indicating that the line whose content is
"-- foo" has been removed from the new version.
git-gui was incorrectly parsing "--- foo" as the old file name
in the file header, causing it to generate a bad patch file when
the user tried to stage or unstage a hunk or the selected line.
We need to keep track of where we are in the parsing so that we do
not misread a deletion or addition record as part of the header.
Reported-by: Alexander Gladysh <agladysh@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Languages like Lua and SQL use "--" to mark a line as commented out.
If this appears at column 0 and is part of the pre-image we may see
"--- foo" in the diff, indicating that the line whose content is
"-- foo" has been removed from the new version.
git-gui was incorrectly parsing "--- foo" as the old file name
in the file header, causing it to generate a bad patch file when
the user tried to stage or unstage a hunk or the selected line.
We need to keep track of where we are in the parsing so that we do
not misread a deletion or addition record as part of the header.
Reported-by: Alexander Gladysh <agladysh@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/diff.tcl | diff | blob | history |