{"thread":{"id":"47574","subject":"[PATCH 1/4] git gui: fix staging a second line to a 1-line file","startedAt":"2018-01-09T14:33:12Z","lastAt":"2018-01-10T14:30:25Z","messageCount":8,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"336254","messageId":"35fabf987c49f3d2adfbbd5b18edcebe3cf06542.1515508360.git.johannes.schindelin@gmx.de","threadId":"47574","inReplyTo":"cover.1515508360.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/4] git gui: fix staging a second line to a 1-line file","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-09T14:32:54Z","receivedAt":"2018-01-09T14:33:12Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When a 1-line file is augmented by a second line, and the user tries to\nstage that single line via the \"Stage Line\" context menu item, we do not\nwant to see \"apply: corrupt patch at line 5\".\n\nThe reason for this error was that the hunk header looks like this:\n\n\t@@ -1 +1,2 @@\n\nbut the existing code expects the original range always to contain a\ncomma. This problem is easily fixed by cutting the string \"1 +1,2\"\n(that Git GUI formerly mistook for the starting line) at the space.\n\nThis fixes https://github.com/git-for-windows/git/issues/515\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-gui/lib/diff.tcl | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex 4cae10a4c7f..68c4a6c7366 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -698,6 +698,7 @@ proc apply_range_or_line {x y} {\n \t\tset hh [$ui_diff get $i_l \"$i_l + 1 lines\"]\n \t\tset hh [lindex [split $hh ,] 0]\n \t\tset hln [lindex [split $hh -] 1]\n+\t\tset hln [lindex [split $hln \" \"] 0]\n \n \t\t# There is a special situation to take care of. Consider this\n \t\t# hunk:\n-- \n2.15.1.windows.2.395.g5bb0817ee52\n\n\n"},{"id":"336255","messageId":"7cd5ed902e3d8102903d494ba3450b1d745928a9.1515508360.git.johannes.schindelin@gmx.de","threadId":"47574","inReplyTo":"cover.1515508360.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/4] git-gui: avoid exception upon Ctrl+T in an empty list","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-09T14:32:58Z","receivedAt":"2018-01-09T14:33:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Previously unstaged files can be staged by clicking on them and then\npressing Ctrl+T. Conveniently, the next unstaged file is selected\nautomatically so that the unstaged files can be staged by repeatedly\npressing Ctrl+T.\n\nWhen a user hits Ctrl+T one time too many, though, Git GUI used to throw\nthis exception:\n\n\texpected number but got \"\"\n\texpected number but got \"\"\n\t    while executing\n\t\"expr {int([lindex [$w tag ranges in_diff] 0])}\"\n\t    (procedure \"toggle_or_diff\" line 13)\n\t    invoked from within\n\t\"toggle_or_diff toggle .vpane.files.workdir.list \"\n\t    (command bound to event)\n\nLet's just avoid that by skipping the operation when there are no more\nfiles to stage.\n\nThis fixes https://github.com/git-for-windows/git/issues/1060\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-gui/git-gui.sh | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex ed24aa9d2f1..3c085cddc61 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2504,6 +2504,10 @@ proc toggle_or_diff {mode w args} {\n \t\tif {$last_clicked ne {}} {\n \t\t\tset lno [lindex $last_clicked 1]\n \t\t} else {\n+\t\t\tif {[llength $file_lists($w)] == 0} {\n+\t\t\t\tset last_clicked {}\n+\t\t\t\treturn\n+\t\t\t}\n \t\t\tset lno [expr {int([lindex [$w tag ranges in_diff] 0])}]\n \t\t}\n \t\tif {$mode eq \"toggle\"} {\n-- \n2.15.1.windows.2.395.g5bb0817ee52\n\n\n"},{"id":"336256","messageId":"c227a5f8354c736abca92e9b040f7e6f569af119.1515508360.git.johannes.schindelin@gmx.de","threadId":"47574","inReplyTo":"cover.1515508360.git.johannes.schindelin@gmx.de","subject":"[PATCH 3/4] git-gui: fix exception when trying to stage with empty file list","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-09T14:33:01Z","receivedAt":"2018-01-09T14:33:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"If there is nothing to stage, there is nothing to stage. Let's not try\nto, even if the file list contains nothing at all.\n\nThis fixes https://github.com/git-for-windows/git/issues/1075\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-gui/git-gui.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 3c085cddc61..ca2cdebdc4f 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2504,7 +2504,9 @@ proc toggle_or_diff {mode w args} {\n \t\tif {$last_clicked ne {}} {\n \t\t\tset lno [lindex $last_clicked 1]\n \t\t} else {\n-\t\t\tif {[llength $file_lists($w)] == 0} {\n+\t\t\tif {![info exists file_lists]\n+\t\t\t\t|| ![info exists file_lists($w)]\n+\t\t\t\t|| [llength $file_lists($w)] == 0} {\n \t\t\t\tset last_clicked {}\n \t\t\t\treturn\n \t\t\t}\n@@ -2518,7 +2520,13 @@ proc toggle_or_diff {mode w args} {\n \t\t}\n \t}\n \n-\tset path [lindex $file_lists($w) [expr {$lno - 1}]]\n+\tif {![info exists file_lists]\n+\t\t|| ![info exists file_lists($w)]\n+\t\t|| [llength $file_lists($w)] < $lno - 1} {\n+\t\tset path {}\n+\t} else {\n+\t\tset path [lindex $file_lists($w) [expr {$lno - 1}]]\n+\t}\n \tif {$path eq {}} {\n \t\tset last_clicked {}\n \t\treturn\n-- \n2.15.1.windows.2.395.g5bb0817ee52\n\n\n"},{"id":"336257","messageId":"3f01f30f6fce762e127c45c361b009e7b6de33b4.1515508360.git.johannes.schindelin@gmx.de","threadId":"47574","inReplyTo":"cover.1515508360.git.johannes.schindelin@gmx.de","subject":"[PATCH 4/4] git-gui: allow Ctrl+T to toggle multiple paths","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-09T14:33:04Z","receivedAt":"2018-01-09T14:33:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"It is possible to select multiple files in the \"Unstaged Changes\" and\nthe \"Staged Changes\" lists. But when hitting Ctrl+T, surprisingly only\none entry is handled, not all selected ones.\n\nLet's just use the same code path as for the \"Stage To Commit\" and the\n\"Unstage From Commit\" menu items.\n\nThis fixes https://github.com/git-for-windows/git/issues/1012\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-gui/git-gui.sh | 13 +++++++++++++\n 1 file changed, 13 insertions(+)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex ca2cdebdc4f..91c00e64893 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2501,6 +2501,19 @@ proc toggle_or_diff {mode w args} {\n \t\tset pos [split [$w index @$x,$y] .]\n \t\tforeach {lno col} $pos break\n \t} else {\n+\t\tif {$mode eq \"toggle\"} {\n+\t\t\tif {$w eq $ui_workdir} {\n+\t\t\t\tdo_add_selection\n+\t\t\t\tset last_clicked {}\n+\t\t\t\treturn\n+\t\t\t}\n+\t\t\tif {$w eq $ui_index} {\n+\t\t\t\tdo_unstage_selection\n+\t\t\t\tset last_clicked {}\n+\t\t\t\treturn\n+\t\t\t}\n+\t\t}\n+\n \t\tif {$last_clicked ne {}} {\n \t\t\tset lno [lindex $last_clicked 1]\n \t\t} else {\n-- \n2.15.1.windows.2.395.g5bb0817ee52\n"},{"id":"336258","messageId":"cover.1515508360.git.johannes.schindelin@gmx.de","threadId":"47574","inReplyTo":null,"subject":"[PATCH 0/4] \"Fast-\"track Git GUI changes","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-09T14:32:50Z","receivedAt":"2018-01-09T14:33:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"As it seems to be impossible to get the attention of the Git GUI\nmaintainer these \"days\" (I have opened Pull Requests on October 16th\n2016 that have not even been looked at), let's just side-step that\ncontribution path which seems to be dormant.\n\nThese fixes have been in Git for Windows for various amounts of time.\n\nNote: there are more Git GUI changes in Git for Windows, I only\naccumulated the ones I deem wort considering for inclusion into v2.16.0,\nstill.\n\n\nJohannes Schindelin (4):\n  git gui: fix staging a second line to a 1-line file\n  git-gui: avoid exception upon Ctrl+T in an empty list\n  git-gui: fix exception when trying to stage with empty file list\n  git-gui: allow Ctrl+T to toggle multiple paths\n\n git-gui/git-gui.sh   | 27 ++++++++++++++++++++++++++-\n git-gui/lib/diff.tcl |  1 +\n 2 files changed, 27 insertions(+), 1 deletion(-)\n\n\nbase-commit: 36438dc19dd2a305dddebd44bf7a65f1a220075b\nPublished-As: https://github.com/dscho/git/releases/tag/misc-git-gui-stuff-v1\nFetch-It-Via: git fetch https://github.com/dscho/git misc-git-gui-stuff-v1\n-- \n2.15.1.windows.2.395.g5bb0817ee52\n\n"},{"id":"336293","messageId":"xmqqinca6em2.fsf@gitster.mtv.corp.google.com","threadId":"47574","inReplyTo":"cover.1515508360.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH 0/4] \"Fast-\"track Git GUI changes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-09T19:01:25Z","receivedAt":"2018-01-09T19:01:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> As it seems to be impossible to get the attention of the Git GUI\n> maintainer these \"days\" (I have opened Pull Requests on October 16th\n> 2016 that have not even been looked at), let's just side-step that\n> contribution path which seems to be dormant.\n\nGood to see that finally somebody else steps up after I did the same\nfor a few times recently.\n\n> These fixes have been in Git for Windows for various amounts of time.\n>\n> Note: there are more Git GUI changes in Git for Windows, I only\n> accumulated the ones I deem wort considering for inclusion into v2.16.0,\n> still.\n\nThanks.  I am not sure if it is too late for 2.16, as these are not\nfixes for regression during this cycle, though.\n\n"},{"id":"336296","messageId":"xmqqbmi26e84.fsf@gitster.mtv.corp.google.com","threadId":"47574","inReplyTo":"xmqqinca6em2.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 0/4] \"Fast-\"track Git GUI changes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-09T19:09:47Z","receivedAt":"2018-01-09T19:10:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n>\n>> As it seems to be impossible to get the attention of the Git GUI\n>> maintainer these \"days\" (I have opened Pull Requests on October 16th\n>> 2016 that have not even been looked at), let's just side-step that\n>> contribution path which seems to be dormant.\n>\n> Good to see that finally somebody else steps up after I did the same\n> for a few times recently.\n>\n>> These fixes have been in Git for Windows for various amounts of time.\n>>\n>> Note: there are more Git GUI changes in Git for Windows, I only\n>> accumulated the ones I deem wort considering for inclusion into v2.16.0,\n>> still.\n>\n> Thanks.  I am not sure if it is too late for 2.16, as these are not\n> fixes for regression during this cycle, though.\n\nHeh, I changed my mind.  \n\nJust like I pretended to be interim maintainer of Git-GUI for the\npast two times, you are doing the same this time and I even agreed\nthat it was a good thing that you volunteered to pretend as one.\n\nSo let's follow through the pretence to its conclusion and merge\nthese directly to 'master'.\n\nThanks.\n"},{"id":"336381","messageId":"nycvar.QRO.7.76.6.1801101530010.37@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz","threadId":"47574","inReplyTo":"xmqqbmi26e84.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 0/4] \"Fast-\"track Git GUI changes","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-01-10T14:30:14Z","receivedAt":"2018-01-10T14:30:25Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 9 Jan 2018, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n> >\n> >> As it seems to be impossible to get the attention of the Git GUI\n> >> maintainer these \"days\" (I have opened Pull Requests on October 16th\n> >> 2016 that have not even been looked at), let's just side-step that\n> >> contribution path which seems to be dormant.\n> >\n> > Good to see that finally somebody else steps up after I did the same\n> > for a few times recently.\n> >\n> >> These fixes have been in Git for Windows for various amounts of time.\n> >>\n> >> Note: there are more Git GUI changes in Git for Windows, I only\n> >> accumulated the ones I deem wort considering for inclusion into v2.16.0,\n> >> still.\n> >\n> > Thanks.  I am not sure if it is too late for 2.16, as these are not\n> > fixes for regression during this cycle, though.\n> \n> Heh, I changed my mind.  \n> \n> Just like I pretended to be interim maintainer of Git-GUI for the\n> past two times, you are doing the same this time and I even agreed\n> that it was a good thing that you volunteered to pretend as one.\n> \n> So let's follow through the pretence to its conclusion and merge\n> these directly to 'master'.\n\nThank you, fellow pretender.\n\nCiao,\nDscho\n"}]}