From: Bert Wesarg Date: Mon, 06 Dec 2010 21:30:08 GMT Subject: Re: Git Gui does not want to work on chunk level Message-ID: In-Reply-To: On Tue, Nov 30, 2010 at 23:20, Bert Wesarg wrote: > On Tue, Nov 30, 2010 at 22:19, Bert Wesarg wrote: >> On Mon, Sep 15, 2008 at 09:08, Johannes Sixt wrote: >>>  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. > > Here is a proposal which fixes this case. Not tested on the OPs report. > > --8<-- > diff --git a/lib/diff.tcl b/lib/diff.tcl > index 8fea947..b3901c3 100644 > --- a/lib/diff.tcl > +++ b/lib/diff.tcl > @@ -398,7 +398,6 @@ proc read_diff {fd conflict_size cont_info} { >                if {$line eq {deleted file mode 120000}} { >                        set line "deleted symlink" >                } > -               set ::current_diff_inheader 0 > >                # -- Automatically detect if this is a 3 way diff. >                # > @@ -414,6 +413,7 @@ proc read_diff {fd conflict_size cont_info} { >                        || [regexp {^\* Unmerged path } $line]} { >                        set tags {} >                } elseif {$is_3way_diff} { > +                       set ::current_diff_inheader 0 >                        set op [string range $line 0 1] >                        switch -- $op { >                        {  } {set tags {}} > @@ -440,6 +440,7 @@ proc read_diff {fd conflict_size cont_info} { >                        } >                        } >                } elseif {$is_submodule_diff} { > +                       set ::current_diff_inheader 0 >                        if {$line == ""} continue >                        if {[regexp {^Submodule } $line]} { >                                set tags d_@ > @@ -459,6 +460,7 @@ proc read_diff {fd conflict_size cont_info} { >                                } >                        } >                } else { > +                       set ::current_diff_inheader 0 >                        set op [string index $line 0] >                        switch -- $op { >                        { } {set tags {}} > Please ignore this proposal. I have a better solution in the pipe (which solves both problems reported here). Bert