Re: [PATCH] git-gui: allow "\ No newline at end of file" for linewise staging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tested the patch as I am the same person that bothered about the
behavior a while ago. Please merge.
- Sorry for sending an HTML formatted mail before.

On Thu, May 9, 2013 at 6:30 PM, Heiko Voigt <hvoigt@xxxxxxxxxx> wrote:
> Counting of lines did not skip this line when generating the hunk
> header.
>
> Signed-off-by: Heiko Voigt <hvoigt@xxxxxxxxxx>
> ---
> Here is an attempt at fixing the no newline issue. I would appreciate
> another pair of eyes though.
>
>  git-gui/lib/diff.tcl | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
> index ec44055..30d9a79 100644
> --- a/git-gui/lib/diff.tcl
> +++ b/git-gui/lib/diff.tcl
> @@ -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
> --
> 1.8.3.rc1.40.gba374ae
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]