git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jepler@unpythonic.net
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Heiko Voigt <hvoigt@hvoigt.net>,
	Peter Baumann <waste.manager@gmx.de>,
	Jeff Epler <jepler@unpythonic.net>
Subject: [PATCH 1/2] Fix applying a line when all following lines are deletions
Date: Mon,  7 Dec 2009 18:22:42 -0600	[thread overview]
Message-ID: <1260231763-19194-2-git-send-email-jepler@unpythonic.net> (raw)
In-Reply-To: <1260231763-19194-1-git-send-email-jepler@unpythonic.net>

From: Jeff Epler <jepler@unpythonic.net>

If a diff looked like
 @@
  context
 -del1
 -del2
and you wanted to stage the deletion 'del1', the generated patch wouldn't
apply because it was missing the line 'del2' converted to context, but
this line was counted in the @@-line

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
---
 lib/diff.tcl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index bd5d189..066755b 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -664,6 +664,7 @@ proc apply_line {x y} {
 		}
 		set i_l $next_l
 	}
+	set patch "$patch$pre_context"
 	set patch "@@ -$hln,$n +$hln,[eval expr $n $sign 1] @@\n$patch"
 
 	if {[catch {
-- 
1.6.3.3

  reply	other threads:[~2009-12-08  0:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08  0:22 [PATCHv3 0/2] git-gui: (un)stage a range of changes at once jepler
2009-12-08  0:22 ` jepler [this message]
2009-12-08  0:22 ` [PATCH 2/2] Make it possible to apply " jepler
2010-01-23 23:05   ` Shawn O. Pearce

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260231763-19194-2-git-send-email-jepler@unpythonic.net \
    --to=jepler@unpythonic.net \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=spearce@spearce.org \
    --cc=waste.manager@gmx.de \
    /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.
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 NNTP newsgroup(s).