git-gui: allow "\ No newline at end of file" for linewise staging
Counting of lines did not skip this line when generating the hunk header. Acked-by: Tobias Preuss <tobias.preuss@googlemail.com> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
This commit is contained in:
11
lib/diff.tcl
11
lib/diff.tcl
@ -764,8 +764,15 @@ proc apply_range_or_line {x y} {
|
|||||||
# context line
|
# context line
|
||||||
set ln [$ui_diff get $i_l $next_l]
|
set ln [$ui_diff get $i_l $next_l]
|
||||||
set patch "$patch$pre_context$ln"
|
set patch "$patch$pre_context$ln"
|
||||||
set n [expr $n+1]
|
# Skip the "\ No newline at end of
|
||||||
set m [expr $m+1]
|
# file". Depending on the locale setting
|
||||||
|
# we don't know what this line looks
|
||||||
|
# like exactly. The only thing we do
|
||||||
|
# know is that it starts with "\ "
|
||||||
|
if {![string match {\\ *} $ln]} {
|
||||||
|
set n [expr $n+1]
|
||||||
|
set m [expr $m+1]
|
||||||
|
}
|
||||||
set pre_context {}
|
set pre_context {}
|
||||||
} elseif {$c1 eq $to_context} {
|
} elseif {$c1 eq $to_context} {
|
||||||
# turn change line into context line
|
# turn change line into context line
|
||||||
|
Reference in New Issue
Block a user