From: Tobias Preuss <tobias.preuss@googlemail.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>,
Junio C Hamano <gitster@pobox.com>, git <git@vger.kernel.org>
Subject: Re: [PATCH] git-gui: allow "\ No newline at end of file" for linewise staging
Date: Fri, 10 May 2013 21:09:53 +0200 [thread overview]
Message-ID: <CADEaiE_ddTLO0kYL5siN4rmycibuzHA3R1dz9mKyueYd0y_atw@mail.gmail.com> (raw)
In-Reply-To: <20130509163002.GA3630@book-mint>
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@hvoigt.net> wrote:
> Counting of lines did not skip this line when generating the hunk
> header.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
> 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
>
prev parent reply other threads:[~2013-05-10 19:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 20:26 git-gui / Warning: "No newline at end of file” Tobias Preuss
2013-01-03 12:26 ` Fwd: " Tobias Preuss
[not found] ` <7vzk0qw8ts.fsf@alter.siamese.dyndns.org>
2013-01-09 14:49 ` Pat Thoyts
2013-05-09 16:30 ` [PATCH] git-gui: allow "\ No newline at end of file" for linewise staging Heiko Voigt
2013-05-10 19:09 ` Tobias Preuss [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEaiE_ddTLO0kYL5siN4rmycibuzHA3R1dz9mKyueYd0y_atw@mail.gmail.com \
--to=tobias.preuss@googlemail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=patthoyts@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).