git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 1/2] Fix applying a line when all following lines are deletions

From
Jeff Epler <jepler@unpythonic.net>
Date
Oct 21, 2009, 21:20 UTC
Message-ID
<1256160023-29629-2-git-send-email-jepler@unpythonic.net>
In-Reply-To
<1256160023-29629-1-git-send-email-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
---
 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.5.rc1.49.ge970
Previous: Jeff EplerNext: Shawn O. Pearce
Message 2 of 12 in “git-gui: (un)stage a range of changes at once”
  1. 0/2 git-gui: (un)stage a range of changes at onceJeff Epler, Oct 21, 2009
  2. 1/2 Fix applying a line when all following lines are deletionsJeff Epler, Oct 21, 2009
  3. Shawn O. PearceDec 5, 2009
  4. 2/2 Make it possible to apply a range of changes at onceJeff Epler, Oct 21, 2009
  5. Jeff EplerOct 26, 2009
  6. Shawn O. PearceDec 5, 2009
  7. Heiko VoigtDec 7, 2009
  8. Jeff EplerDec 8, 2009
  9. Heiko VoigtDec 11, 2009
  10. Peter BaumannOct 29, 2009
  11. Heiko VoigtDec 4, 2009
  12. Shawn O. PearceDec 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.