From: Bert Wesarg Date: Tue, 30 Nov 2010 21:19:38 GMT Subject: Re: Git Gui does not want to work on chunk level Message-ID: In-Reply-To: <48CE09EF.7090609@viscovery.net> On Mon, Sep 15, 2008 at 09:08, Johannes Sixt wrote: > Shawn O. Pearce schrieb: >> 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. > > This (slightly) breaks parsing of new files and removed files that are > staged by showing the file names in the diff header: > >  new file mode 100644 >  --- /dev/null >  +++ b/foo >  @@ -0,0 +1 @@ >  +foo I just noticed the same, and ask me why this report wasn't honored. Also git may spill out 2 diffs for type changes (file to symlink, for example). In this case the we should probably disable any hunk- or line-level (un)staging. Bert > > -- Hannes