Skip to content

Commit

Permalink
git-gui: allow "\ No newline at end of file" for linewise staging
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heiko Voigt authored and Pat Thoyts committed May 16, 2013
1 parent 60468d6 commit 1fcd24d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/diff.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,15 @@ proc apply_range_or_line {x y} {
# context line
set ln [$ui_diff get $i_l $next_l]
set patch "$patch$pre_context$ln"
set n [expr $n+1]
set m [expr $m+1]
# Skip the "\ No newline at end of
# 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 {}
} elseif {$c1 eq $to_context} {
# turn change line into context line
Expand Down

0 comments on commit 1fcd24d

Please sign in to comment.