git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH 0/4] "Fast-"track Git GUI changes
@ 2018-01-09 14:32 Johannes Schindelin
  2018-01-09 14:32 ` [PATCH 1/4] git gui: fix staging a second line to a 1-line file Johannes Schindelin
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-09 14:32 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

As it seems to be impossible to get the attention of the Git GUI
maintainer these "days" (I have opened Pull Requests on October 16th
2016 that have not even been looked at), let's just side-step that
contribution path which seems to be dormant.

These fixes have been in Git for Windows for various amounts of time.

Note: there are more Git GUI changes in Git for Windows, I only
accumulated the ones I deem wort considering for inclusion into v2.16.0,
still.


Johannes Schindelin (4):
  git gui: fix staging a second line to a 1-line file
  git-gui: avoid exception upon Ctrl+T in an empty list
  git-gui: fix exception when trying to stage with empty file list
  git-gui: allow Ctrl+T to toggle multiple paths

 git-gui/git-gui.sh   | 27 ++++++++++++++++++++++++++-
 git-gui/lib/diff.tcl |  1 +
 2 files changed, 27 insertions(+), 1 deletion(-)


base-commit: 36438dc19dd2a305dddebd44bf7a65f1a220075b
Published-As: https://github.com/dscho/git/releases/tag/misc-git-gui-stuff-v1
Fetch-It-Via: git fetch https://github.com/dscho/git misc-git-gui-stuff-v1
-- 
2.15.1.windows.2.395.g5bb0817ee52


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

* [PATCH 1/4] git gui: fix staging a second line to a 1-line file
  2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
@ 2018-01-09 14:32 ` Johannes Schindelin
  2018-01-09 14:32 ` [PATCH 2/4] git-gui: avoid exception upon Ctrl+T in an empty list Johannes Schindelin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-09 14:32 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

When a 1-line file is augmented by a second line, and the user tries to
stage that single line via the "Stage Line" context menu item, we do not
want to see "apply: corrupt patch at line 5".

The reason for this error was that the hunk header looks like this:

	@@ -1 +1,2 @@

but the existing code expects the original range always to contain a
comma. This problem is easily fixed by cutting the string "1 +1,2"
(that Git GUI formerly mistook for the starting line) at the space.

This fixes https://github.com/git-for-windows/git/issues/515

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui/lib/diff.tcl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index 4cae10a4c7f..68c4a6c7366 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -698,6 +698,7 @@ proc apply_range_or_line {x y} {
 		set hh [$ui_diff get $i_l "$i_l + 1 lines"]
 		set hh [lindex [split $hh ,] 0]
 		set hln [lindex [split $hh -] 1]
+		set hln [lindex [split $hln " "] 0]
 
 		# There is a special situation to take care of. Consider this
 		# hunk:
-- 
2.15.1.windows.2.395.g5bb0817ee52



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

* [PATCH 2/4] git-gui: avoid exception upon Ctrl+T in an empty list
  2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
  2018-01-09 14:32 ` [PATCH 1/4] git gui: fix staging a second line to a 1-line file Johannes Schindelin
@ 2018-01-09 14:32 ` Johannes Schindelin
  2018-01-09 14:33 ` [PATCH 3/4] git-gui: fix exception when trying to stage with empty file list Johannes Schindelin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-09 14:32 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Previously unstaged files can be staged by clicking on them and then
pressing Ctrl+T. Conveniently, the next unstaged file is selected
automatically so that the unstaged files can be staged by repeatedly
pressing Ctrl+T.

When a user hits Ctrl+T one time too many, though, Git GUI used to throw
this exception:

	expected number but got ""
	expected number but got ""
	    while executing
	"expr {int([lindex [$w tag ranges in_diff] 0])}"
	    (procedure "toggle_or_diff" line 13)
	    invoked from within
	"toggle_or_diff toggle .vpane.files.workdir.list "
	    (command bound to event)

Let's just avoid that by skipping the operation when there are no more
files to stage.

This fixes https://github.com/git-for-windows/git/issues/1060

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui/git-gui.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index ed24aa9d2f1..3c085cddc61 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2504,6 +2504,10 @@ proc toggle_or_diff {mode w args} {
 		if {$last_clicked ne {}} {
 			set lno [lindex $last_clicked 1]
 		} else {
+			if {[llength $file_lists($w)] == 0} {
+				set last_clicked {}
+				return
+			}
 			set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
 		}
 		if {$mode eq "toggle"} {
-- 
2.15.1.windows.2.395.g5bb0817ee52



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

* [PATCH 3/4] git-gui: fix exception when trying to stage with empty file list
  2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
  2018-01-09 14:32 ` [PATCH 1/4] git gui: fix staging a second line to a 1-line file Johannes Schindelin
  2018-01-09 14:32 ` [PATCH 2/4] git-gui: avoid exception upon Ctrl+T in an empty list Johannes Schindelin
@ 2018-01-09 14:33 ` Johannes Schindelin
  2018-01-09 14:33 ` [PATCH 4/4] git-gui: allow Ctrl+T to toggle multiple paths Johannes Schindelin
  2018-01-09 19:01 ` [PATCH 0/4] "Fast-"track Git GUI changes Junio C Hamano
  4 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-09 14:33 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

If there is nothing to stage, there is nothing to stage. Let's not try
to, even if the file list contains nothing at all.

This fixes https://github.com/git-for-windows/git/issues/1075

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui/git-gui.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 3c085cddc61..ca2cdebdc4f 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2504,7 +2504,9 @@ proc toggle_or_diff {mode w args} {
 		if {$last_clicked ne {}} {
 			set lno [lindex $last_clicked 1]
 		} else {
-			if {[llength $file_lists($w)] == 0} {
+			if {![info exists file_lists]
+				|| ![info exists file_lists($w)]
+				|| [llength $file_lists($w)] == 0} {
 				set last_clicked {}
 				return
 			}
@@ -2518,7 +2520,13 @@ proc toggle_or_diff {mode w args} {
 		}
 	}
 
-	set path [lindex $file_lists($w) [expr {$lno - 1}]]
+	if {![info exists file_lists]
+		|| ![info exists file_lists($w)]
+		|| [llength $file_lists($w)] < $lno - 1} {
+		set path {}
+	} else {
+		set path [lindex $file_lists($w) [expr {$lno - 1}]]
+	}
 	if {$path eq {}} {
 		set last_clicked {}
 		return
-- 
2.15.1.windows.2.395.g5bb0817ee52



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

* [PATCH 4/4] git-gui: allow Ctrl+T to toggle multiple paths
  2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
                   ` (2 preceding siblings ...)
  2018-01-09 14:33 ` [PATCH 3/4] git-gui: fix exception when trying to stage with empty file list Johannes Schindelin
@ 2018-01-09 14:33 ` Johannes Schindelin
  2018-01-09 19:01 ` [PATCH 0/4] "Fast-"track Git GUI changes Junio C Hamano
  4 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-09 14:33 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

It is possible to select multiple files in the "Unstaged Changes" and
the "Staged Changes" lists. But when hitting Ctrl+T, surprisingly only
one entry is handled, not all selected ones.

Let's just use the same code path as for the "Stage To Commit" and the
"Unstage From Commit" menu items.

This fixes https://github.com/git-for-windows/git/issues/1012

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-gui/git-gui.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index ca2cdebdc4f..91c00e64893 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2501,6 +2501,19 @@ proc toggle_or_diff {mode w args} {
 		set pos [split [$w index @$x,$y] .]
 		foreach {lno col} $pos break
 	} else {
+		if {$mode eq "toggle"} {
+			if {$w eq $ui_workdir} {
+				do_add_selection
+				set last_clicked {}
+				return
+			}
+			if {$w eq $ui_index} {
+				do_unstage_selection
+				set last_clicked {}
+				return
+			}
+		}
+
 		if {$last_clicked ne {}} {
 			set lno [lindex $last_clicked 1]
 		} else {
-- 
2.15.1.windows.2.395.g5bb0817ee52

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

* Re: [PATCH 0/4] "Fast-"track Git GUI changes
  2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
                   ` (3 preceding siblings ...)
  2018-01-09 14:33 ` [PATCH 4/4] git-gui: allow Ctrl+T to toggle multiple paths Johannes Schindelin
@ 2018-01-09 19:01 ` Junio C Hamano
  2018-01-09 19:09   ` Junio C Hamano
  4 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2018-01-09 19:01 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> As it seems to be impossible to get the attention of the Git GUI
> maintainer these "days" (I have opened Pull Requests on October 16th
> 2016 that have not even been looked at), let's just side-step that
> contribution path which seems to be dormant.

Good to see that finally somebody else steps up after I did the same
for a few times recently.

> These fixes have been in Git for Windows for various amounts of time.
>
> Note: there are more Git GUI changes in Git for Windows, I only
> accumulated the ones I deem wort considering for inclusion into v2.16.0,
> still.

Thanks.  I am not sure if it is too late for 2.16, as these are not
fixes for regression during this cycle, though.


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

* Re: [PATCH 0/4] "Fast-"track Git GUI changes
  2018-01-09 19:01 ` [PATCH 0/4] "Fast-"track Git GUI changes Junio C Hamano
@ 2018-01-09 19:09   ` Junio C Hamano
  2018-01-10 14:30     ` Johannes Schindelin
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2018-01-09 19:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>
>> As it seems to be impossible to get the attention of the Git GUI
>> maintainer these "days" (I have opened Pull Requests on October 16th
>> 2016 that have not even been looked at), let's just side-step that
>> contribution path which seems to be dormant.
>
> Good to see that finally somebody else steps up after I did the same
> for a few times recently.
>
>> These fixes have been in Git for Windows for various amounts of time.
>>
>> Note: there are more Git GUI changes in Git for Windows, I only
>> accumulated the ones I deem wort considering for inclusion into v2.16.0,
>> still.
>
> Thanks.  I am not sure if it is too late for 2.16, as these are not
> fixes for regression during this cycle, though.

Heh, I changed my mind.  

Just like I pretended to be interim maintainer of Git-GUI for the
past two times, you are doing the same this time and I even agreed
that it was a good thing that you volunteered to pretend as one.

So let's follow through the pretence to its conclusion and merge
these directly to 'master'.

Thanks.

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

* Re: [PATCH 0/4] "Fast-"track Git GUI changes
  2018-01-09 19:09   ` Junio C Hamano
@ 2018-01-10 14:30     ` Johannes Schindelin
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Schindelin @ 2018-01-10 14:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Tue, 9 Jan 2018, Junio C Hamano wrote:

> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> >
> >> As it seems to be impossible to get the attention of the Git GUI
> >> maintainer these "days" (I have opened Pull Requests on October 16th
> >> 2016 that have not even been looked at), let's just side-step that
> >> contribution path which seems to be dormant.
> >
> > Good to see that finally somebody else steps up after I did the same
> > for a few times recently.
> >
> >> These fixes have been in Git for Windows for various amounts of time.
> >>
> >> Note: there are more Git GUI changes in Git for Windows, I only
> >> accumulated the ones I deem wort considering for inclusion into v2.16.0,
> >> still.
> >
> > Thanks.  I am not sure if it is too late for 2.16, as these are not
> > fixes for regression during this cycle, though.
> 
> Heh, I changed my mind.  
> 
> Just like I pretended to be interim maintainer of Git-GUI for the
> past two times, you are doing the same this time and I even agreed
> that it was a good thing that you volunteered to pretend as one.
> 
> So let's follow through the pretence to its conclusion and merge
> these directly to 'master'.

Thank you, fellow pretender.

Ciao,
Dscho

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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 14:32 [PATCH 0/4] "Fast-"track Git GUI changes Johannes Schindelin
2018-01-09 14:32 ` [PATCH 1/4] git gui: fix staging a second line to a 1-line file Johannes Schindelin
2018-01-09 14:32 ` [PATCH 2/4] git-gui: avoid exception upon Ctrl+T in an empty list Johannes Schindelin
2018-01-09 14:33 ` [PATCH 3/4] git-gui: fix exception when trying to stage with empty file list Johannes Schindelin
2018-01-09 14:33 ` [PATCH 4/4] git-gui: allow Ctrl+T to toggle multiple paths Johannes Schindelin
2018-01-09 19:01 ` [PATCH 0/4] "Fast-"track Git GUI changes Junio C Hamano
2018-01-09 19:09   ` Junio C Hamano
2018-01-10 14:30     ` Johannes Schindelin

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox