Re: Git Gui does not want to work on chunk level
On Tue, Nov 30, 2010 at 22:19, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
Show 12 quoted lines
> On Mon, Sep 15, 2008 at 09:08, Johannes Sixt <j.sixt@viscovery.net> 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 {}}