git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
@ 2009-10-21 21:20 Jeff Epler
  2009-10-21 21:20 ` [RFC PATCH 1/2] Fix applying a line when all following lines are deletions Jeff Epler
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jeff Epler @ 2009-10-21 21:20 UTC (permalink / raw)
  To: git; +Cc: Jeff Epler

Compared to the first version, I fixed a bug concerning staging line(s)
when all following lines are deletions (a preexisting bug in git-gui).
This version is made based off the master branch of git-gui.git, rather
than the master branch of git.git.

The first change fixes a long-standing git-gui bug in an area that the
new feature is rewriting anyway.  If there's interest in the new feature
then maybe the two should just be squashed (using the message from the
second).  If not, it'd be nice to see the bugfix applied anyway.


Jeff Epler (2):
  Fix applying a line when all following lines are deletions
  Make it possible to apply a range of changes at once

 git-gui.sh   |   15 +++-
 lib/diff.tcl |  224 ++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 135 insertions(+), 104 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH 1/2] Fix applying a line when all following lines are deletions
  2009-10-21 21:20 [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once Jeff Epler
@ 2009-10-21 21:20 ` Jeff Epler
  2009-12-05 21:32   ` Shawn O. Pearce
  2009-10-21 21:20 ` [RFC PATCH 2/2] Make it possible to apply a range of changes at once Jeff Epler
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Jeff Epler @ 2009-10-21 21:20 UTC (permalink / raw)
  To: git; +Cc: Jeff Epler

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 2/2] Make it possible to apply a range of changes at once
  2009-10-21 21:20 [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once Jeff Epler
  2009-10-21 21:20 ` [RFC PATCH 1/2] Fix applying a line when all following lines are deletions Jeff Epler
@ 2009-10-21 21:20 ` Jeff Epler
  2009-10-26 19:39 ` [RFC PATCH v2 0/2] git-gui: (un)stage " Jeff Epler
  2009-10-29  7:34 ` Peter Baumann
  3 siblings, 0 replies; 12+ messages in thread
From: Jeff Epler @ 2009-10-21 21:20 UTC (permalink / raw)
  To: git; +Cc: Jeff Epler

---
The diff looks bigger than it is because it changed the indentation
level of about 80 lines, and that made it necessary to reflow a lengthy
commit block as well.

 git-gui.sh   |   15 +++-
 lib/diff.tcl |  225 ++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 135 insertions(+), 105 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 09b2720..c69d904 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3194,7 +3194,7 @@ set ui_diff_applyhunk [$ctxm index last]
 lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state]
 $ctxm add command \
 	-label [mc "Apply/Reverse Line"] \
-	-command {apply_line $cursorX $cursorY; do_rescan}
+	-command {apply_range_or_line $cursorX $cursorY; do_rescan}
 set ui_diff_applyline [$ctxm index last]
 lappend diff_actions [list $ctxm entryconf $ui_diff_applyline -state]
 $ctxm add separator
@@ -3234,12 +3234,21 @@ proc popup_diff_menu {ctxm ctxmmg x y X Y} {
 	if {[string first {U} $state] >= 0} {
 		tk_popup $ctxmmg $X $Y
 	} else {
+		set has_range [expr {[$::ui_diff tag nextrange sel 0.0] != {}}]
 		if {$::ui_index eq $::current_diff_side} {
 			set l [mc "Unstage Hunk From Commit"]
-			set t [mc "Unstage Line From Commit"]
+			if {$has_range} {
+				set t [mc "Unstage Lines From Commit"]
+			} else {
+				set t [mc "Unstage Line From Commit"]
+			}
 		} else {
 			set l [mc "Stage Hunk For Commit"]
-			set t [mc "Stage Line For Commit"]
+			if {$has_range} {
+				set t [mc "Stage Lines For Commit"]
+			} else {
+				set t [mc "Stage Line For Commit"]
+			}
 		}
 		if {$::is_3way_diff || $::is_submodule_diff
 			|| $current_diff_path eq {}
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 066755b..0fe3ec6 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -533,10 +533,23 @@ proc apply_hunk {x y} {
 	}
 }
 
-proc apply_line {x y} {
+proc apply_range_or_line {x y} {
 	global current_diff_path current_diff_header current_diff_side
 	global ui_diff ui_index file_states
 
+	set selected [$ui_diff tag nextrange sel 0.0]
+
+	if {$selected == {}} {
+		set first [$ui_diff index "@$x,$y"]
+		set last $first
+	} else {
+		set first [lindex $selected 0]
+		set last [lindex $selected 1]
+	}
+
+	set first_l [$ui_diff index "$first linestart"]
+	set last_l [$ui_diff index "$last lineend"]
+
 	if {$current_diff_path eq {} || $current_diff_header eq {}} return
 	if {![lock_index apply_hunk]} return
 
@@ -559,120 +572,128 @@ proc apply_line {x y} {
 		}
 	}
 
-	set the_l [$ui_diff index @$x,$y]
+	set wholepatch {}
 
-	# operate only on change lines
-	set c1 [$ui_diff get "$the_l linestart"]
-	if {$c1 ne {+} && $c1 ne {-}} {
-		unlock_index
-		return
-	}
-	set sign $c1
-
-	set i_l [$ui_diff search -backwards -regexp ^@@ $the_l 0.0]
-	if {$i_l eq {}} {
-		unlock_index
-		return
-	}
-	# $i_l is now at the beginning of a line
+	while {$first_l < $last_l} {
+		set i_l [$ui_diff search -backwards -regexp ^@@ $first_l 0.0]
+		if {$i_l eq {}} {
+			# If there's not a @@ above, then the selected range
+			# must have come before the first_l @@
+			set i_l [$ui_diff search -regexp ^@@ $first_l $last_l]
+		}
+		if {$i_l eq {}} {
+			unlock_index
+			return
+		}
+		# $i_l is now at the beginning of a line
 
-	# pick start line number from hunk header
-	set hh [$ui_diff get $i_l "$i_l + 1 lines"]
-	set hh [lindex [split $hh ,] 0]
-	set hln [lindex [split $hh -] 1]
+		# pick start line number from hunk header
+		set hh [$ui_diff get $i_l "$i_l + 1 lines"]
+		set hh [lindex [split $hh ,] 0]
+		set hln [lindex [split $hh -] 1]
 
-	# There is a special situation to take care of. Consider this hunk:
-	#
-	#    @@ -10,4 +10,4 @@
-	#     context before
-	#    -old 1
-	#    -old 2
-	#    +new 1
-	#    +new 2
-	#     context after
-	#
-	# We used to keep the context lines in the order they appear in the
-	# hunk. But then it is not possible to correctly stage only
-	# "-old 1" and "+new 1" - it would result in this staged text:
-	#
-	#    context before
-	#    old 2
-	#    new 1
-	#    context after
-	#
-	# (By symmetry it is not possible to *un*stage "old 2" and "new 2".)
-	#
-	# We resolve the problem by introducing an asymmetry, namely, when
-	# a "+" line is *staged*, it is moved in front of the context lines
-	# that are generated from the "-" lines that are immediately before
-	# the "+" block. That is, we construct this patch:
-	#
-	#    @@ -10,4 +10,5 @@
-	#     context before
-	#    +new 1
-	#     old 1
-	#     old 2
-	#     context after
-	#
-	# But we do *not* treat "-" lines that are *un*staged in a special
-	# way.
-	#
-	# With this asymmetry it is possible to stage the change
-	# "old 1" -> "new 1" directly, and to stage the change
-	# "old 2" -> "new 2" by first staging the entire hunk and
-	# then unstaging the change "old 1" -> "new 1".
-
-	# This is non-empty if and only if we are _staging_ changes;
-	# then it accumulates the consecutive "-" lines (after converting
-	# them to context lines) in order to be moved after the "+" change
-	# line.
-	set pre_context {}
-
-	set n 0
-	set i_l [$ui_diff index "$i_l + 1 lines"]
-	set patch {}
-	while {[$ui_diff compare $i_l < "end - 1 chars"] &&
-	       [$ui_diff get $i_l "$i_l + 2 chars"] ne {@@}} {
-		set next_l [$ui_diff index "$i_l + 1 lines"]
-		set c1 [$ui_diff get $i_l]
-		if {[$ui_diff compare $i_l <= $the_l] &&
-		    [$ui_diff compare $the_l < $next_l]} {
-			# the line to stage/unstage
-			set ln [$ui_diff get $i_l $next_l]
-			if {$c1 eq {-}} {
-				set n [expr $n+1]
+		# There is a special situation to take care of. Consider this
+		# hunk:
+		#
+		#    @@ -10,4 +10,4 @@
+		#     context before
+		#    -old 1
+		#    -old 2
+		#    +new 1
+		#    +new 2
+		#     context after
+		#
+		# We used to keep the context lines in the order they appear in
+		# the hunk. But then it is not possible to correctly stage only
+		# "-old 1" and "+new 1" - it would result in this staged text:
+		#
+		#    context before
+		#    old 2
+		#    new 1
+		#    context after
+		#
+		# (By symmetry it is not possible to *un*stage "old 2" and "new
+		# 2".)
+		#
+		# We resolve the problem by introducing an asymmetry, namely,
+		# when a "+" line is *staged*, it is moved in front of the
+		# context lines that are generated from the "-" lines that are
+		# immediately before the "+" block. That is, we construct this
+		# patch:
+		#
+		#    @@ -10,4 +10,5 @@
+		#     context before
+		#    +new 1
+		#     old 1
+		#     old 2
+		#     context after
+		#
+		# But we do *not* treat "-" lines that are *un*staged in a
+		# special way.
+		#
+		# With this asymmetry it is possible to stage the change "old
+		# 1" -> "new 1" directly, and to stage the change "old 2" ->
+		# "new 2" by first staging the entire hunk and then unstaging
+		# the change "old 1" -> "new 1".
+
+		# This is non-empty if and only if we are _staging_ changes;
+		# then it accumulates the consecutive "-" lines (after
+		# converting them to context lines) in order to be moved after
+		# the "+" change line.
+		set pre_context {}
+
+		set n 0
+		set m 0
+		set i_l [$ui_diff index "$i_l + 1 lines"]
+		set patch {}
+		while {[$ui_diff compare $i_l < "end - 1 chars"] &&
+		       [$ui_diff get $i_l "$i_l + 2 chars"] ne {@@}} {
+			set next_l [$ui_diff index "$i_l + 1 lines"]
+			set c1 [$ui_diff get $i_l]
+			if {[$ui_diff compare $first_l <= $i_l] &&
+			    [$ui_diff compare $i_l < $last_l] &&
+			    ($c1 eq {-} || $c1 eq {+})} {
+				# a line to stage/unstage
+				set ln [$ui_diff get $i_l $next_l]
+				if {$c1 eq {-}} {
+					set n [expr $n+1]
+					set patch "$patch$pre_context$ln"
+				} else {
+					set m [expr $m+1]
+					set patch "$patch$ln$pre_context"
+				}
+				set pre_context {}
+			} elseif {$c1 ne {-} && $c1 ne {+}} {
+				# context line
+				set ln [$ui_diff get $i_l $next_l]
 				set patch "$patch$pre_context$ln"
-			} else {
-				set patch "$patch$ln$pre_context"
-			}
-			set pre_context {}
-		} elseif {$c1 ne {-} && $c1 ne {+}} {
-			# context line
-			set ln [$ui_diff get $i_l $next_l]
-			set patch "$patch$pre_context$ln"
-			set n [expr $n+1]
-			set pre_context {}
-		} elseif {$c1 eq $to_context} {
-			# turn change line into context line
-			set ln [$ui_diff get "$i_l + 1 chars" $next_l]
-			if {$c1 eq {-}} {
-				set pre_context "$pre_context $ln"
-			} else {
-				set patch "$patch $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
+				set ln [$ui_diff get "$i_l + 1 chars" $next_l]
+				if {$c1 eq {-}} {
+					set pre_context "$pre_context $ln"
+				} else {
+					set patch "$patch $ln"
+				}
+				set n [expr $n+1]
+				set m [expr $m+1]
 			}
-			set n [expr $n+1]
+			set i_l $next_l
 		}
-		set i_l $next_l
+		set patch "$patch$pre_context"
+		set wholepatch "$wholepatch@@ -$hln,$n +$hln,$m @@\n$patch"
+		set first_l [$ui_diff index "$next_l + 1 lines"]
 	}
-	set patch "$patch$pre_context"
-	set patch "@@ -$hln,$n +$hln,[eval expr $n $sign 1] @@\n$patch"
 
 	if {[catch {
 		set enc [get_path_encoding $current_diff_path]
 		set p [eval git_write $apply_cmd]
 		fconfigure $p -translation binary -encoding $enc
 		puts -nonewline $p $current_diff_header
-		puts -nonewline $p $patch
+		puts -nonewline $p $wholepatch
 		close $p} err]} {
 		error_popup [append $failed_msg "\n\n$err"]
 	}
-- 
1.6.5.rc1.49.ge970

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-10-21 21:20 [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once Jeff Epler
  2009-10-21 21:20 ` [RFC PATCH 1/2] Fix applying a line when all following lines are deletions Jeff Epler
  2009-10-21 21:20 ` [RFC PATCH 2/2] Make it possible to apply a range of changes at once Jeff Epler
@ 2009-10-26 19:39 ` Jeff Epler
  2009-12-05 21:36   ` Shawn O. Pearce
  2009-10-29  7:34 ` Peter Baumann
  3 siblings, 1 reply; 12+ messages in thread
From: Jeff Epler @ 2009-10-26 19:39 UTC (permalink / raw)
  To: git

I've found another problem, which I'll work on as soon as I find a
chance.

When staging multiple "+" lines preceded by a "-" line that must be
turned into context, the converted "-" line must come after *all* the
"+" lines, not just the first one.

Jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-10-21 21:20 [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once Jeff Epler
                   ` (2 preceding siblings ...)
  2009-10-26 19:39 ` [RFC PATCH v2 0/2] git-gui: (un)stage " Jeff Epler
@ 2009-10-29  7:34 ` Peter Baumann
  2009-12-04 22:07   ` Heiko Voigt
  3 siblings, 1 reply; 12+ messages in thread
From: Peter Baumann @ 2009-10-29  7:34 UTC (permalink / raw)
  To: Jeff Epler; +Cc: Shawn O. Pearce, git

On Wed, Oct 21, 2009 at 04:20:21PM -0500, Jeff Epler wrote:
> Compared to the first version, I fixed a bug concerning staging line(s)
> when all following lines are deletions (a preexisting bug in git-gui).
> This version is made based off the master branch of git-gui.git, rather
> than the master branch of git.git.
> 
> The first change fixes a long-standing git-gui bug in an area that the
> new feature is rewriting anyway.  If there's interest in the new feature
> then maybe the two should just be squashed (using the message from the
> second).  If not, it'd be nice to see the bugfix applied anyway.
> 
> 
> Jeff Epler (2):
>   Fix applying a line when all following lines are deletions
>   Make it possible to apply a range of changes at once
> 
>  git-gui.sh   |   15 +++-
>  lib/diff.tcl |  224 ++++++++++++++++++++++++++++++++--------------------------
>  2 files changed, 135 insertions(+), 104 deletions(-)

Cc ing Shawn as the git gui maintainer, as he might have missed this series
during his away time.

The original series including user comments can be found at

	http://thread.gmane.org/gmane.comp.version-control.git/130732

whereas the newest version is here:

	http://thread.gmane.org/gmane.comp.version-control.git/130968

--
Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-10-29  7:34 ` Peter Baumann
@ 2009-12-04 22:07   ` Heiko Voigt
  2009-12-05 21:19     ` Shawn O. Pearce
  0 siblings, 1 reply; 12+ messages in thread
From: Heiko Voigt @ 2009-12-04 22:07 UTC (permalink / raw)
  To: Peter Baumann; +Cc: Jeff Epler, Shawn O. Pearce, git

Hi,

On Thu, Oct 29, 2009 at 08:34:54AM +0100, Peter Baumann wrote:
> On Wed, Oct 21, 2009 at 04:20:21PM -0500, Jeff Epler wrote:
> > 
> > Jeff Epler (2):
> >   Fix applying a line when all following lines are deletions
> >   Make it possible to apply a range of changes at once
> > 
> >  git-gui.sh   |   15 +++-
> >  lib/diff.tcl |  224 ++++++++++++++++++++++++++++++++--------------------------
> >  2 files changed, 135 insertions(+), 104 deletions(-)
> 
> Cc ing Shawn as the git gui maintainer, as he might have missed this series
> during his away time.
> 
> The original series including user comments can be found at
> 
> 	http://thread.gmane.org/gmane.comp.version-control.git/130732
> 
> whereas the newest version is here:
> 
> 	http://thread.gmane.org/gmane.comp.version-control.git/130968

Ping? A short reminder for Shawn as I do not see the patches in his
tree.

cheers Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-12-04 22:07   ` Heiko Voigt
@ 2009-12-05 21:19     ` Shawn O. Pearce
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn O. Pearce @ 2009-12-05 21:19 UTC (permalink / raw)
  To: Heiko Voigt; +Cc: Peter Baumann, Jeff Epler, git

Heiko Voigt <hvoigt@hvoigt.net> wrote:
> On Thu, Oct 29, 2009 at 08:34:54AM +0100, Peter Baumann wrote:
> > Cc ing Shawn as the git gui maintainer, as he might have missed this series
> > during his away time.
> 
> Ping? A short reminder for Shawn as I do not see the patches in his
> tree.

I have a stack of git-gui patches which I've just ignored in
my inbox.  I'll work through them this afternoon.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 1/2] Fix applying a line when all following lines are deletions
  2009-10-21 21:20 ` [RFC PATCH 1/2] Fix applying a line when all following lines are deletions Jeff Epler
@ 2009-12-05 21:32   ` Shawn O. Pearce
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn O. Pearce @ 2009-12-05 21:32 UTC (permalink / raw)
  To: Jeff Epler; +Cc: git

Jeff Epler <jepler@unpythonic.net> wrote:
> 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"

Signed-off-by ?

-- 
Shawn.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-10-26 19:39 ` [RFC PATCH v2 0/2] git-gui: (un)stage " Jeff Epler
@ 2009-12-05 21:36   ` Shawn O. Pearce
  2009-12-07 12:54     ` Heiko Voigt
  0 siblings, 1 reply; 12+ messages in thread
From: Shawn O. Pearce @ 2009-12-05 21:36 UTC (permalink / raw)
  To: Jeff Epler; +Cc: git

Jeff Epler <jepler@unpythonic.net> wrote:
> I've found another problem, which I'll work on as soon as I find a
> chance.
> 
> When staging multiple "+" lines preceded by a "-" line that must be
> turned into context, the converted "-" line must come after *all* the
> "+" lines, not just the first one.

So the reason this series got stuck was this message, this bug is
enough to suggest we shouldn't apply it to my tree yet, so I've
been waiting for an update on the topic.

Also, I need a Signed-off-by line.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-12-05 21:36   ` Shawn O. Pearce
@ 2009-12-07 12:54     ` Heiko Voigt
  2009-12-08  0:38       ` Jeff Epler
  0 siblings, 1 reply; 12+ messages in thread
From: Heiko Voigt @ 2009-12-07 12:54 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Jeff Epler, git

On Sat, Dec 05, 2009 at 01:36:13PM -0800, Shawn O. Pearce wrote:
> Jeff Epler <jepler@unpythonic.net> wrote:
> > I've found another problem, which I'll work on as soon as I find a
> > chance.
> > 
> > When staging multiple "+" lines preceded by a "-" line that must be
> > turned into context, the converted "-" line must come after *all* the
> > "+" lines, not just the first one.
> 
> So the reason this series got stuck was this message, this bug is
> enough to suggest we shouldn't apply it to my tree yet, so I've
> been waiting for an update on the topic.

In an attempt to help this series forward I tried to reproduce this bug
but were unsuccessfull. It seems that a change like this:

@@ -13,7 +13,9 @@ set appvers {@@GITGUI_VERSION@@}
 set copyright [encoding convertfrom utf-8 {
 Copyright © 2006, 2007 Shawn Pearce, et. al.
 
-This program is free software; you can redistribute it and/or modify
+Blabla
+blubblub
+lalala
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

and then trying to stage part of the '+' lines is not enough. Jeff could you
clarify or provide an example?

cheers Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-12-07 12:54     ` Heiko Voigt
@ 2009-12-08  0:38       ` Jeff Epler
  2009-12-11 18:57         ` Heiko Voigt
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Epler @ 2009-12-08  0:38 UTC (permalink / raw)
  To: Heiko Voigt; +Cc: Shawn O. Pearce, git

On Mon, Dec 07, 2009 at 01:54:35PM +0100, Heiko Voigt wrote:
> Jeff could you clarify or provide an example?

If I recall correctly, the problem with the v2 patch was when the change
was like
    @@ -13,8 +13,8 @@ set appvers {@@GITGUI_VERSION@@}
     set copyright [encoding convertfrom utf-8 {
     Copyright © 2006, 2007 Shawn Pearce, et. al.

    -This program is free software; you can redistribute it and/or modify
    -it under the terms of the GNU General Public License as published by
    +blah blah
    +blah blah
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
and the 'blah blah' lines were both staged in the same operation.

When doing this, the staged change is actually
    +blah blah
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
    +blah blah

but the change that should have been staged is:
    +blah blah
    +blah blah
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by

Since it requires staging multiple "+" lines in one go, this problem
doesn't exist in git-gui before my changes.

The v3 patch I posted just a few minutes ago fixes this problem.

Jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: Re: [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once
  2009-12-08  0:38       ` Jeff Epler
@ 2009-12-11 18:57         ` Heiko Voigt
  0 siblings, 0 replies; 12+ messages in thread
From: Heiko Voigt @ 2009-12-11 18:57 UTC (permalink / raw)
  To: Jeff Epler; +Cc: Shawn O. Pearce, git

On Mon, Dec 07, 2009 at 06:38:36PM -0600, Jeff Epler wrote:
> On Mon, Dec 07, 2009 at 01:54:35PM +0100, Heiko Voigt wrote:
> > Jeff could you clarify or provide an example?
> 
> If I recall correctly, the problem with the v2 patch was when the change
> was like
>     @@ -13,8 +13,8 @@ set appvers {@@GITGUI_VERSION@@}
>      set copyright [encoding convertfrom utf-8 {
>      Copyright © 2006, 2007 Shawn Pearce, et. al.
> 
>     -This program is free software; you can redistribute it and/or modify
>     -it under the terms of the GNU General Public License as published by
>     +blah blah
>     +blah blah
>      the Free Software Foundation; either version 2 of the License, or
>      (at your option) any later version.
> and the 'blah blah' lines were both staged in the same operation.

Thanks Jeff that was the missing piece. I was able to reproduce the
behavior and I can confirm it is gone with the new series. I was not yet
able to read through all of the code.

cheers Heiko

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-12-11 18:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-21 21:20 [RFC PATCH v2 0/2] git-gui: (un)stage a range of changes at once Jeff Epler
2009-10-21 21:20 ` [RFC PATCH 1/2] Fix applying a line when all following lines are deletions Jeff Epler
2009-12-05 21:32   ` Shawn O. Pearce
2009-10-21 21:20 ` [RFC PATCH 2/2] Make it possible to apply a range of changes at once Jeff Epler
2009-10-26 19:39 ` [RFC PATCH v2 0/2] git-gui: (un)stage " Jeff Epler
2009-12-05 21:36   ` Shawn O. Pearce
2009-12-07 12:54     ` Heiko Voigt
2009-12-08  0:38       ` Jeff Epler
2009-12-11 18:57         ` Heiko Voigt
2009-10-29  7:34 ` Peter Baumann
2009-12-04 22:07   ` Heiko Voigt
2009-12-05 21:19     ` Shawn O. Pearce

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).