{"thread":{"id":"10182","subject":"[PATCH] git-gui: offer a list of recent repositories on startup","startedAt":"2007-10-07T21:28:21Z","lastAt":"2007-10-10T15:43:59Z","messageCount":10,"participants":["Steffen Prohaska","Shawn O. Pearce","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"55089","messageId":"11917925011987-git-send-email-prohaska@zib.de","threadId":"10182","inReplyTo":null,"subject":"[PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-10-07T21:28:21Z","receivedAt":"2007-10-07T21:28:21Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"If git-gui is started outside a work tree the repository\nchooser will offer a list of recently opend repositories.\nClicking on an entry directly opens the repository.\n\nThe list of recently opened repositories is stored in the\nconfig as gui.recentrepos. If the list grows beyond 10\nentries it will be truncated.\n\nNote, only repositories that are opened through the\nrepository chooser will get added to the recent list.\nRepositories opened from the shell will not yet be added.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n git-gui/lib/choose_repository.tcl |   47 +++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\n\nThe commit is also available on branch\nsteffen/git-gui-openrecent in 4msysgit.\n\n\nShawn,\nI'd suggest to reduce the number of clicks needed to open or\nclone an existing directory that is not in the list of\nrecent repositories. First choosing from the radiobuttons\nand then clicking next is one click to much. There are no\noptions to combine. Choosing from the list should\nimmediately trigger the action.\n\nWe could either put 'Create/Clone/Open New Repository' into\nthe Repository menu and only present the recent repository\nlist. Or we could offer push buttons for the other actions.\n\n\tSteffen\n\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 16bf67c..bfc8780 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -116,9 +116,26 @@ constructor pick {} {\n \t\t-text [mc \"Open Existing Repository\"] \\\n \t\t-variable @action \\\n \t\t-value open\n+\tlabel $w_body.space\n+\tlabel $w_body.recentlabel \\\n+\t\t-anchor w \\\n+\t\t-text \"Select Recent Repository:\"\n+\tlistbox $w_body.recentlist \\\n+\t\t-relief flat \\\n+\t\t-width 50 \\\n+\t\t-height 10 \\\n+\t\t-exportselection false \\\n+\t\t-selectmode select\n+\tforeach p [_get_recentrepos] {\n+\t\t$w_body.recentlist insert end $p\n+\t}\n+\tbind $w_body.recentlist <<ListboxSelect>> [cb _open_recent]\n \tpack $w_body.new -anchor w -fill x\n \tpack $w_body.clone -anchor w -fill x\n \tpack $w_body.open -anchor w -fill x\n+\tpack $w_body.space -anchor w -fill x\n+\tpack $w_body.recentlabel -anchor w -fill x\n+\tpack $w_body.recentlist -anchor w -fill x\n \tpack $w_body -fill x -padx 10 -pady 10\n \n \tframe $w.buttons\n@@ -171,6 +188,34 @@ method _invoke_next {} {\n \t}\n }\n \n+proc _get_recentrepos {} {\n+\tset recent [list]\n+\tforeach p [get_config gui.recentrepos] {\n+\t\tif {[file isdirectory [file join $p .git]]} {\n+\t\t\tlappend recent $p\n+\t\t}\n+\t}\n+\treturn [lsort $recent]\n+}\n+\n+proc _append_recentrepos {path} {\n+\tset recent [get_config gui.recentrepos]\n+\tif {[lsearch $recent $path] < 0} {\n+\t\tlappend recent $path\n+\t}\n+\tif {[llength $recent] > 10} {\n+\t\tset recent [lrange $recent 1 end]\n+\t}\n+\tregsub -all \"\\[{}\\]\" $recent {\"} recent\n+\tgit config --global gui.recentrepos $recent\n+}\n+\n+method _open_recent {} {\n+\tset id [$w_body.recentlist curselection]\n+\tset local_path [$w_body.recentlist get $id]\n+\t_do_open2 $this\n+}\n+\n method _next {} {\n \tdestroy $w_body\n \t_do_$action $this\n@@ -893,6 +938,8 @@ method _do_open2 {} {\n \t\treturn\n \t}\n \n+\t_append_recentrepos $local_path\n+\n \tset ::_gitdir .git\n \tset ::_prefix {}\n \tset done 1\n-- \n1.5.3.mingw.1.110.gef4c8\n"},{"id":"55128","messageId":"20071007233023.GE2137@spearce.org","threadId":"10182","inReplyTo":"11917925011987-git-send-email-prohaska@zib.de","subject":"Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-07T23:30:23Z","receivedAt":"2007-10-07T23:30:23Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> wrote:\n> If git-gui is started outside a work tree the repository\n> chooser will offer a list of recently opend repositories.\n> Clicking on an entry directly opens the repository.\n> \n> The list of recently opened repositories is stored in the\n> config as gui.recentrepos. If the list grows beyond 10\n> entries it will be truncated.\n> \n> Note, only repositories that are opened through the\n> repository chooser will get added to the recent list.\n> Repositories opened from the shell will not yet be added.\n\nI think that all makes a lot of sense.  Three comments below about\nthis patch in particular.\n \n> I'd suggest to reduce the number of clicks needed to open or\n> clone an existing directory that is not in the list of\n> recent repositories. First choosing from the radiobuttons\n> and then clicking next is one click to much. There are no\n> options to combine. Choosing from the list should\n> immediately trigger the action.\n> \n> We could either put 'Create/Clone/Open New Repository' into\n> the Repository menu and only present the recent repository\n> list. Or we could offer push buttons for the other actions.\n\nI agree entirely.  That \"Next\" button is stupid stupid stupid.\nWhat was I smoking that day?  :-)\n\nI'm concerned about putting them into the Repository menu only\nas then the main window is competely void and users are sort of\nwondering what they should do next.  I think we should actually\ndo both.  Put them into the menu and as push buttons on the window.\n\n> +\tlabel $w_body.space\n> +\tlabel $w_body.recentlabel \\\n> +\t\t-anchor w \\\n> +\t\t-text \"Select Recent Repository:\"\n\nThis string needs to be i18n'd with [mc ...].\n\n> +\tlistbox $w_body.recentlist \\\n\nPlease make a field in this class called say \"w_recentlist\"\nso you can use that field name instead of $w_body.recentlist.\nThis simplifies the code if we ever have to change the actual path\nthat the widget resides at, such as to alter the layout.\n\n> +proc _append_recentrepos {path} {\n> +\tset recent [get_config gui.recentrepos]\n> +\tif {[lsearch $recent $path] < 0} {\n> +\t\tlappend recent $path\n> +\t}\n> +\tif {[llength $recent] > 10} {\n> +\t\tset recent [lrange $recent 1 end]\n> +\t}\n> +\tregsub -all \"\\[{}\\]\" $recent {\"} recent\n> +\tgit config --global gui.recentrepos $recent\n> +}\n\nWhy treat this as a Tcl list in a single value?  Why not make it\na true multi-value configuration entry in ~/.gitconfig, like how\nremote.$name.fetch is a multi-value entry?  Does Windows allow\nyou to put \" in a path name?  Because the above regex will make\na list of paths that contains \" in one of the entries invalid.\n\nI think you also want to have this function return back immediately\nif [lsearch $recent $path] >= 0 as then you don't invoke git-config\nto perform a no-op change in the configuration file.  As you well\nknow forking on Windows is a major cost.  We shouldn't run git-config\njust because the user opened a recent repository.\n\n-- \nShawn.\n"},{"id":"55192","messageId":"BE872860-40AD-4BBA-BDD5-0EC8CB9AC4B5@zib.de","threadId":"10182","inReplyTo":"20071007233023.GE2137@spearce.org","subject":"Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-10-08T14:16:51Z","receivedAt":"2007-10-08T14:16:51Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Shawn,\nI attached two patches. They should eventually be both squashed into  \none.\nYou can also cherry pick them from work/setup-preview in 4msysgit.\nI'm not yet fully convinced of the performance of the second patch.\nIt is far from optimal, although it might be sufficient.\n\nIf you're satisfied with the current implementation you can squash them\ninto a single commit; or ask me to do that.\n\nMore comments below, after the summary.\n\n\ncommit a483fdd562d6c44d68a998224e0bbb17933b624a\nAuthor: Steffen Prohaska <prohaska@zib.de>\nDate:   Mon Oct 8 08:25:47 2007 +0200\n\n     git-gui: offer a list of recent repositories on startup\n\n     If git-gui is started outside a work tree the repository\n     chooser will offer a list of recently opend repositories.\n     Clicking on an entry directly opens the repository.\n\n     The list of recently opened repositories is stored in the\n     config as gui.recentrepos. If the list grows beyond 10\n     entries it will be truncated.\n\n     Note, only repositories that are opened through the\n     repository chooser will get added to the recent list.\n     Repositories opened from the shell will not yet be added.\n\n     Signed-off-by: Steffen Prohaska <prohaska@zib.de>\n\ncommit a9f083e83717eef91ba8842ece4a3ec0824126af\nAuthor: Steffen Prohaska <prohaska@zib.de>\nDate:   Mon Oct 8 08:14:34 2007 +0200\n\n     git-gui: handle list of recent repos as multi config gui.recentrepo\n\n     Instead of encoding the list of recently opened repositories\n     in a single config line, this commit uses multiple lines of\n     gui.recentrepo.\n\n     An advantage is that the solution makes the list explicit\n     on the git config level. This may be easier to understand\n     if the user wants to look at the configuration.\n\n     A disadvantage (of the current implementation) is that it\n     requires more git config calls to manage the list. This could\n     be optimized. But maybe not required because the list is only\n     updated on opening a new repository, which is already a quite\n     expensive operation.\n\n     Signed-off-by: Steffen Prohaska <prohaska@zib.de>\n\n\nOn Oct 8, 2007, at 1:30 AM, Shawn O. Pearce wrote:\n\n> Steffen Prohaska <prohaska@zib.de> wrote:\n>\n>> +\tlabel $w_body.space\n>> +\tlabel $w_body.recentlabel \\\n>> +\t\t-anchor w \\\n>> +\t\t-text \"Select Recent Repository:\"\n>\n> This string needs to be i18n'd with [mc ...].\n\nchanged in first patch.\n\n>> +\tlistbox $w_body.recentlist \\\n>\n> Please make a field in this class called say \"w_recentlist\"\n> so you can use that field name instead of $w_body.recentlist.\n> This simplifies the code if we ever have to change the actual path\n> that the widget resides at, such as to alter the layout.\n\nchanged in first patch.\n\n\n>> +proc _append_recentrepos {path} {\n>> +\tset recent [get_config gui.recentrepos]\n>> +\tif {[lsearch $recent $path] < 0} {\n>> +\t\tlappend recent $path\n>> +\t}\n>> +\tif {[llength $recent] > 10} {\n>> +\t\tset recent [lrange $recent 1 end]\n>> +\t}\n>> +\tregsub -all \"\\[{}\\]\" $recent {\"} recent\n>> +\tgit config --global gui.recentrepos $recent\n>> +}\n>\n> Why treat this as a Tcl list in a single value?  Why not make it\n> a true multi-value configuration entry in ~/.gitconfig, like how\n> remote.$name.fetch is a multi-value entry?  Does Windows allow\n> you to put \" in a path name?  Because the above regex will make\n> a list of paths that contains \" in one of the entries invalid.\n\nI don't think \" is allowed. I wasn't able to create a file containing\n\" in its path. Neither from the explorer nor on the command line.\n\n\n> I think you also want to have this function return back immediately\n> if [lsearch $recent $path] >= 0 as then you don't invoke git-config\n> to perform a no-op change in the configuration file.  As you well\n> know forking on Windows is a major cost.  We shouldn't run git-config\n> just because the user opened a recent repository.\n>\n\nThe second patch actually runs git config several times to first\nremote all multi-value entries and then create them one by one. This\nis worse performance than before.\n\nThis could be avoided by selectively removing only a single entry.\n'git config' could be asked to only remove the entry that was removed\nfrom the tcl list. But 'git config' only accepts regular expression\nto do so.\n\nI don't know how to escape a simple string to a corresponding\nregular expression that matches only the string but nothing else.\n\nFor my problem it would be much easier if 'git config' accepted just\na plain string that must be matched exactly and not a regular  \nexpression.\n\nI see two solutions:\n1) Someone explains me how to convert a string to a regular expression\nmatching only the input string.\n\n2) \"git config\" is modified to accept a simple string as its second  \nargument.\nMaybe we can use implementation in the second patch for now and wait\nuntil \"git config\" is modified. Note, I'll not start to work on this  \nright\naway because I want to stay focused on the basic functionality on  \nWindows and,\nfor now, do not care about performance too much.\n\n\tSteffen\n\n\n\n\nFrom a483fdd562d6c44d68a998224e0bbb17933b624a Mon Sep 17 00:00:00 2001\nFrom: Steffen Prohaska <prohaska@zib.de>\nDate: Mon, 8 Oct 2007 08:25:47 +0200\nSubject: [PATCH] git-gui: offer a list of recent repositories on startup\n\nIf git-gui is started outside a work tree the repository\nchooser will offer a list of recently opend repositories.\nClicking on an entry directly opens the repository.\n\nThe list of recently opened repositories is stored in the\nconfig as gui.recentrepos. If the list grows beyond 10\nentries it will be truncated.\n\nNote, only repositories that are opened through the\nrepository chooser will get added to the recent list.\nRepositories opened from the shell will not yet be added.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n git-gui/lib/choose_repository.tcl |   49 +++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 16bf67c..4f57572 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -41,6 +41,7 @@ field w_body      ; # Widget holding the center content\n field w_next      ; # Next button\n field o_cons      ; # Console object (if active)\n field w_types     ; # List of type buttons in clone\n+field w_recentlist ; # Listbox containing recent repositories\n \n field action          new ; # What action are we going to perform?\n field done              0 ; # Finished picking the repository?\n@@ -116,9 +117,27 @@ constructor pick {} {\n \t\t-text [mc \"Open Existing Repository\"] \\\n \t\t-variable @action \\\n \t\t-value open\n+\tlabel $w_body.space\n+\tlabel $w_body.recentlabel \\\n+\t\t-anchor w \\\n+\t\t-text [mc \"Select Recent Repository:\"]\n+\tset w_recentlist $w_body.recentlist\n+\tlistbox $w_recentlist \\\n+\t\t-relief flat \\\n+\t\t-width 50 \\\n+\t\t-height 10 \\\n+\t\t-exportselection false \\\n+\t\t-selectmode select\n+\tforeach p [_get_recentrepos] {\n+\t\t$w_recentlist insert end $p\n+\t}\n+\tbind $w_recentlist <<ListboxSelect>> [cb _open_recent]\n \tpack $w_body.new -anchor w -fill x\n \tpack $w_body.clone -anchor w -fill x\n \tpack $w_body.open -anchor w -fill x\n+\tpack $w_body.space -anchor w -fill x\n+\tpack $w_body.recentlabel -anchor w -fill x\n+\tpack $w_recentlist -anchor w -fill x\n \tpack $w_body -fill x -padx 10 -pady 10\n \n \tframe $w.buttons\n@@ -171,6 +190,34 @@ method _invoke_next {} {\n \t}\n }\n \n+proc _get_recentrepos {} {\n+\tset recent [list]\n+\tforeach p [get_config gui.recentrepos] {\n+\t\tif {[file isdirectory [file join $p .git]]} {\n+\t\t\tlappend recent $p\n+\t\t}\n+\t}\n+\treturn [lsort $recent]\n+}\n+\n+proc _append_recentrepos {path} {\n+\tset recent [get_config gui.recentrepos]\n+\tif {[lsearch $recent $path] < 0} {\n+\t\tlappend recent $path\n+\t}\n+\tif {[llength $recent] > 10} {\n+\t\tset recent [lrange $recent 1 end]\n+\t}\n+\tregsub -all \"\\[{}\\]\" $recent {\"} recent\n+\tgit config --global gui.recentrepos $recent\n+}\n+\n+method _open_recent {} {\n+\tset id [$w_recentlist curselection]\n+\tset local_path [$w_recentlist get $id]\n+\t_do_open2 $this\n+}\n+\n method _next {} {\n \tdestroy $w_body\n \t_do_$action $this\n@@ -893,6 +940,8 @@ method _do_open2 {} {\n \t\treturn\n \t}\n \n+\t_append_recentrepos $local_path\n+\n \tset ::_gitdir .git\n \tset ::_prefix {}\n \tset done 1\n-- \n1.5.3.mingw.1.99.gdbfb3\n\n\n\nFrom a9f083e83717eef91ba8842ece4a3ec0824126af Mon Sep 17 00:00:00 2001\nFrom: Steffen Prohaska <prohaska@zib.de>\nDate: Mon, 8 Oct 2007 08:14:34 +0200\nSubject: [PATCH] git-gui: handle list of recent repos as multi config gui.recentrepo\n\nInstead of encoding the list of recently opened repositories\nin a single config line, this commit uses multiple lines of\ngui.recentrepo.\n\nAn advantage is that the solution makes the list explicit\non the git config level. This may be easier to understand\nif the user wants to look at the configuration.\n\nA disadvantage (of the current implementation) is that it\nrequires more git config calls to manage the list. This could\nbe optimized. But maybe not required because the list is only\nupdated on opening a new repository, which is already a quite\nexpensive operation.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n git-gui/git-gui.sh                |    3 ++-\n git-gui/lib/choose_repository.tcl |   15 +++++++++------\n 2 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 3f5927f..8e56294 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -206,7 +206,8 @@ proc disable_option {option} {\n proc is_many_config {name} {\n \tswitch -glob -- $name {\n \tremote.*.fetch -\n-\tremote.*.push\n+\tremote.*.push -\n+\tgui.recentrepo\n \t\t{return 1}\n \t*\n \t\t{return 0}\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 4f57572..9f6926c 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -192,7 +192,7 @@ method _invoke_next {} {\n \n proc _get_recentrepos {} {\n \tset recent [list]\n-\tforeach p [get_config gui.recentrepos] {\n+\tforeach p [get_config gui.recentrepo] {\n \t\tif {[file isdirectory [file join $p .git]]} {\n \t\t\tlappend recent $p\n \t\t}\n@@ -201,15 +201,18 @@ proc _get_recentrepos {} {\n }\n \n proc _append_recentrepos {path} {\n-\tset recent [get_config gui.recentrepos]\n-\tif {[lsearch $recent $path] < 0} {\n-\t\tlappend recent $path\n+\tset recent [get_config gui.recentrepo]\n+\tif {[lsearch $recent $path] >= 0} {\n+\t\treturn\n \t}\n+\tlappend recent $path\n \tif {[llength $recent] > 10} {\n \t\tset recent [lrange $recent 1 end]\n \t}\n-\tregsub -all \"\\[{}\\]\" $recent {\"} recent\n-\tgit config --global gui.recentrepos $recent\n+\tgit config --global --unset-all gui.recentrepo\n+\tforeach p $recent {\n+\t\tgit config --global --add gui.recentrepo $p\n+\t}\n }\n \n method _open_recent {} {\n-- \n1.5.3.mingw.1.99.gdbfb3\n\n\n\n\n\n"},{"id":"55256","messageId":"Pine.LNX.4.64.0710091240540.4174@racer.site","threadId":"10182","inReplyTo":"BE872860-40AD-4BBA-BDD5-0EC8CB9AC4B5@zib.de","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-09T11:43:26Z","receivedAt":"2007-10-09T11:43:26Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 8 Oct 2007, Steffen Prohaska wrote:\n\n> commit a483fdd562d6c44d68a998224e0bbb17933b624a\n> Author: Steffen Prohaska <prohaska@zib.de>\n> Date:   Mon Oct 8 08:25:47 2007 +0200\n> \n>    git-gui: offer a list of recent repositories on startup\n\nMay I suggest not putting this list into ~/.gitconfig, but rather \n~/.gitguirc?  It is not really a user-specific git configuration...\n\nBesides, the call to \"git-config --global --unset-all gui.recentrepo\" \nfails, as far as I can tell because there is not yet such an entry.\n\nCiao,\nDscho\n"},{"id":"55263","messageId":"4A4F8FC7-E0AB-4C07-B4C8-AFE2EBD9C3DD@zib.de","threadId":"10182","inReplyTo":"Pine.LNX.4.64.0710091240540.4174@racer.site","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-10-09T12:42:05Z","receivedAt":"2007-10-09T12:42:05Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Oct 9, 2007, at 1:43 PM, Johannes Schindelin wrote:\n\n> On Mon, 8 Oct 2007, Steffen Prohaska wrote:\n>\n>> commit a483fdd562d6c44d68a998224e0bbb17933b624a\n>> Author: Steffen Prohaska <prohaska@zib.de>\n>> Date:   Mon Oct 8 08:25:47 2007 +0200\n>>\n>>    git-gui: offer a list of recent repositories on startup\n>\n> May I suggest not putting this list into ~/.gitconfig, but rather\n> ~/.gitguirc?  It is not really a user-specific git configuration...\n\ngit-gui already stores other options as global variables gui.*.\n(see git-gui/lib/option.tcl). I just added gui.recentrepo. The\nlist of recent repos should go to wherever git-gui stores its options.\n\nRight now this is in ~/.gitconfig, if I understand correctly. Shawn?\n\n\tSteffen\n"},{"id":"55330","messageId":"20071010044030.GJ2137@spearce.org","threadId":"10182","inReplyTo":"4A4F8FC7-E0AB-4C07-B4C8-AFE2EBD9C3DD@zib.de","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-10T04:40:30Z","receivedAt":"2007-10-10T04:40:30Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> wrote:\n> On Oct 9, 2007, at 1:43 PM, Johannes Schindelin wrote:\n> >On Mon, 8 Oct 2007, Steffen Prohaska wrote:\n> >\n> >>commit a483fdd562d6c44d68a998224e0bbb17933b624a\n> >>Author: Steffen Prohaska <prohaska@zib.de>\n> >>Date:   Mon Oct 8 08:25:47 2007 +0200\n> >>\n> >>   git-gui: offer a list of recent repositories on startup\n> >\n> >May I suggest not putting this list into ~/.gitconfig, but rather\n> >~/.gitguirc?  It is not really a user-specific git configuration...\n> \n> git-gui already stores other options as global variables gui.*.\n> (see git-gui/lib/option.tcl). I just added gui.recentrepo. The\n> list of recent repos should go to wherever git-gui stores its options.\n> \n> Right now this is in ~/.gitconfig, if I understand correctly. Shawn?\n\nYes, that's correct.\n\nAn item on my todo list (see todo branch in git-gui.git) is to move\nthis into a ~/.gitguiconfig or something like that, but I was going\nto keep it as a git-config style file so git-config can be used to\nprocess its contents.\n\nUntil that task is complete I'd rather keep all of the \"gui\" options\nin ~/.gitconfig (global) or .git/config (per-repository).  When I\nsplit stuff out to git-gui specific files I'll have to migrate the\nentire \"gui\" section at once.\n\n-- \nShawn.\n"},{"id":"55341","messageId":"20071010073053.GQ2137@spearce.org","threadId":"10182","inReplyTo":"BE872860-40AD-4BBA-BDD5-0EC8CB9AC4B5@zib.de","subject":"Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-10T07:30:53Z","receivedAt":"2007-10-10T07:30:53Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> wrote:\n> Shawn,\n> I attached two patches. They should eventually be both squashed into  \n> one.\n\nThanks.  I'm applying the patch below over both of yours, and\nthen squashing them all together and keeping you as the author.\n\nI did not like how the listbox looked (or worked!) on Mac OS X.\nClicking on the item was at first a very non-obvious action, and\nthen when I did do it I was very shocked to see the repository open\nimmediately.  My brain knew the action was wired to the selection\nevent (I obviously read the two patches before applying them),\nbut it didn't expect that behavior.  Clearly the wrong UI model.\n\nThe patch below uses a text widget instead and renders each of\nthe repositories as a blue underlined link.  Users will generally\nassume that clicking on such links will take them immediately to\nthat repository (much as it would take them to another webpage if\nthis was a web browser).\n\nThe \"Open Recent Repositories\" is not even shown in the UI if there\naren't any to offer to the user.  Showing them this area just looks\nsilly if they haven't opened or cloned anything yet.\n\nWe now add freshly created or cloned repositories to the list of\nrecently opened repositories.  These are just as fair game for\nbeing recently accessed as any others.  Perhaps even more so as\nusers may wonder where they cloned that repository to the last time\nthey started git-gui.\n\nWe always store the absolute path of a repository into the config.\nThis avoids the mess of opening a repository twice using say a\nrelative path entered into the text entry field and then opening\nit later via a file browser, only to find out you now have the same\nrepository in the recent list twice.\n\nI fixed the --unset-all bug and also avoided the --unset-all/--add\nloop you were using.  We convert the value into a \"safe\" expression\nand then try to match on it.\n\n---\n\ndiff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl\nindex 4deb1ec..bdfdbae 100644\n--- a/lib/choose_repository.tcl\n+++ b/lib/choose_repository.tcl\n@@ -80,27 +80,35 @@ constructor pick {} {\n \t\t-text [mc \"Open Existing Repository\"] \\\n \t\t-variable @action \\\n \t\t-value open\n-\tlabel $w_body.space\n-\tlabel $w_body.recentlabel \\\n-\t\t-anchor w \\\n-\t\t-text [mc \"Select Recent Repository:\"]\n-\tset w_recentlist $w_body.recentlist\n-\tlistbox $w_recentlist \\\n-\t\t-relief flat \\\n-\t\t-width 50 \\\n-\t\t-height 10 \\\n-\t\t-exportselection false \\\n-\t\t-selectmode select\n-\tforeach p [_get_recentrepos] {\n-\t\t$w_recentlist insert end $p\n-\t}\n-\tbind $w_recentlist <<ListboxSelect>> [cb _open_recent]\n \tpack $w_body.new -anchor w -fill x\n \tpack $w_body.clone -anchor w -fill x\n \tpack $w_body.open -anchor w -fill x\n-\tpack $w_body.space -anchor w -fill x\n-\tpack $w_body.recentlabel -anchor w -fill x\n-\tpack $w_recentlist -anchor w -fill x\n+\n+\tset recent [_get_recentrepos]\n+\tif {[llength $recent] > 0} {\n+\t\tlabel $w_body.space\n+\t\tlabel $w_body.recentlabel \\\n+\t\t\t-anchor w \\\n+\t\t\t-text [mc \"Open Recent Repository:\"]\n+\t\tset w_recentlist $w_body.recentlist\n+\t\ttext $w_recentlist \\\n+\t\t\t-cursor $::cursor_ptr \\\n+\t\t\t-wrap none \\\n+\t\t\t-width 50 \\\n+\t\t\t-height 10\n+\t\t$w_recentlist tag conf link \\\n+\t\t\t-foreground blue \\\n+\t\t\t-underline 1\n+\t\tforeach p $recent {\n+\t\t\t$w_recentlist insert end $p link\n+\t\t\t$w_recentlist insert end \"\\n\"\n+\t\t}\n+\t\t$w_recentlist conf -state disabled\n+\t\t$w_recentlist tag bind link <1> [cb _open_recent %x,%y]\n+\t\tpack $w_body.space -anchor w -fill x\n+\t\tpack $w_body.recentlabel -anchor w -fill x\n+\t\tpack $w_recentlist -anchor w -fill x\n+\t}\n \tpack $w_body -fill x -padx 10 -pady 10\n \n \tframe $w.buttons\n@@ -164,23 +172,26 @@ proc _get_recentrepos {} {\n }\n \n proc _append_recentrepos {path} {\n+\tset path [file normalize $path]\n \tset recent [get_config gui.recentrepo]\n \tif {[lsearch $recent $path] >= 0} {\n \t\treturn\n \t}\n+\n \tlappend recent $path\n-\tif {[llength $recent] > 10} {\n+\tgit config --global --add gui.recentrepo $path\n+\n+\twhile {[llength $recent] > 10} {\n+\t\tset p [lindex $recent 0]\n \t\tset recent [lrange $recent 1 end]\n-\t}\n-\tgit config --global --unset-all gui.recentrepo\n-\tforeach p $recent {\n-\t\tgit config --global --add gui.recentrepo $p\n+\t\tregsub -all -- {([()\\[\\]{}\\.^$+*?\\\\])} $p {\\\\\\1} p\n+\t\tgit config --global --unset gui.recentrepo \"^$p\\$\"\n \t}\n }\n \n-method _open_recent {} {\n-\tset id [$w_recentlist curselection]\n-\tset local_path [$w_recentlist get $id]\n+method _open_recent {xy} {\n+\tset id [lindex [split [$w_recentlist index @$xy] .] 0]\n+\tset local_path [$w_recentlist get $id.0 $id.end]\n \t_do_open2 $this\n }\n \n@@ -224,6 +235,7 @@ method _git_init {} {\n \t\treturn 0\n \t}\n \n+\t_append_recentrepos [pwd]\n \tset ::_gitdir .git\n \tset ::_prefix {}\n \treturn 1\n@@ -906,8 +918,7 @@ method _do_open2 {} {\n \t\treturn\n \t}\n \n-\t_append_recentrepos $local_path\n-\n+\t_append_recentrepos [pwd]\n \tset ::_gitdir .git\n \tset ::_prefix {}\n \tset done 1\n\n-- \nShawn.\n"},{"id":"55348","messageId":"B1EFFED4-1DF7-4A0A-93E2-F21812E7AF6B@zib.de","threadId":"10182","inReplyTo":"20071010073053.GQ2137@spearce.org","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-10-10T08:13:27Z","receivedAt":"2007-10-10T08:13:27Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Shawn,\n\nOn Oct 10, 2007, at 9:30 AM, Shawn O. Pearce wrote:\n\n>\n> Steffen Prohaska <prohaska@zib.de> wrote:\n>> Shawn,\n>> I attached two patches. They should eventually be both squashed into\n>> one.\n>\n> Thanks.  I'm applying the patch below over both of yours, and\n> then squashing them all together and keeping you as the author.\n>\n> I did not like how the listbox looked (or worked!) on Mac OS X.\n> Clicking on the item was at first a very non-obvious action, and\n> then when I did do it I was very shocked to see the repository open\n> immediately.  My brain knew the action was wired to the selection\n> event (I obviously read the two patches before applying them),\n> but it didn't expect that behavior.  Clearly the wrong UI model.\n>\n> The patch below uses a text widget instead and renders each of\n> the repositories as a blue underlined link.  Users will generally\n> assume that clicking on such links will take them immediately to\n> that repository (much as it would take them to another webpage if\n> this was a web browser)\n\nThis is similar to what I had in mind, but was lacking tk knowledge\nto implement it.\n\n\n> The \"Open Recent Repositories\" is not even shown in the UI if there\n> aren't any to offer to the user.  Showing them this area just looks\n> silly if they haven't opened or cloned anything yet.\n>\n> We now add freshly created or cloned repositories to the list of\n> recently opened repositories.  These are just as fair game for\n> being recently accessed as any others.  Perhaps even more so as\n> users may wonder where they cloned that repository to the last time\n> they started git-gui.\n>\n> We always store the absolute path of a repository into the config.\n> This avoids the mess of opening a repository twice using say a\n> relative path entered into the text entry field and then opening\n> it later via a file browser, only to find out you now have the same\n> repository in the recent list twice.\n>\n> I fixed the --unset-all bug and also avoided the --unset-all/--add\n> loop you were using.  We convert the value into a \"safe\" expression\n> and then try to match on it.\n\nThat all sound very reasonable to me.\n\nI haven't applied your patch but only read through it. Looks good to me.\n\nThanks,\nSteffen\n"},{"id":"55351","messageId":"20071010081954.GT2137@spearce.org","threadId":"10182","inReplyTo":"B1EFFED4-1DF7-4A0A-93E2-F21812E7AF6B@zib.de","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-10T08:19:54Z","receivedAt":"2007-10-10T08:19:54Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> wrote:\n> On Oct 10, 2007, at 9:30 AM, Shawn O. Pearce wrote:\n> >\n> >The patch below uses a text widget instead and renders each of\n> >the repositories as a blue underlined link.\n> \n> This is similar to what I had in mind, but was lacking tk knowledge\n> to implement it.\n\nHeh.  Tk makes some things easy, assuming you know what you are\ndoing.  It makes some other things damn near impossible, even if\nyou do know all of Tk and its internals too.  Anyway, your patches\nwere a really good start on this and it saved me a lot of time to\njust tweak what you already had.  So I really appreciate you taking\nthe time to work on the first two iterations of this feature.\n\n> I haven't applied your patch but only read through it. Looks good\n> to me.\n\nThe combined result is now in my `pu` branch on repo.or.cz.\nRemember that I freely rebase that branch and any topic in it,\nso I might wind up rebasing this topic before I finally merge it\nto master.\n\nI have given the change some light testing tonight but want to\nbeat on it more and also fix the radio button issue you pointed\nout before I merge this series of improvements into master.\n\n-- \nShawn.\n"},{"id":"55380","messageId":"Pine.LNX.4.64.0710101643190.4174@racer.site","threadId":"10182","inReplyTo":"20071010044030.GJ2137@spearce.org","subject":"Re: [msysGit] Re: [PATCH] git-gui: offer a list of recent repositories on startup","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-10T15:43:59Z","receivedAt":"2007-10-10T15:43:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 10 Oct 2007, Shawn O. Pearce wrote:\n\n> Steffen Prohaska <prohaska@zib.de> wrote:\n> > On Oct 9, 2007, at 1:43 PM, Johannes Schindelin wrote:\n> > >On Mon, 8 Oct 2007, Steffen Prohaska wrote:\n> > >\n> > >>commit a483fdd562d6c44d68a998224e0bbb17933b624a\n> > >>Author: Steffen Prohaska <prohaska@zib.de>\n> > >>Date:   Mon Oct 8 08:25:47 2007 +0200\n> > >>\n> > >>   git-gui: offer a list of recent repositories on startup\n> > >\n> > >May I suggest not putting this list into ~/.gitconfig, but rather\n> > >~/.gitguirc?  It is not really a user-specific git configuration...\n> > \n> > git-gui already stores other options as global variables gui.*.\n> > (see git-gui/lib/option.tcl). I just added gui.recentrepo. The\n> > list of recent repos should go to wherever git-gui stores its options.\n> > \n> > Right now this is in ~/.gitconfig, if I understand correctly. Shawn?\n> \n> Yes, that's correct.\n> \n> An item on my todo list (see todo branch in git-gui.git) is to move\n> this into a ~/.gitguiconfig or something like that, but I was going\n> to keep it as a git-config style file so git-config can be used to\n> process its contents.\n> \n> Until that task is complete I'd rather keep all of the \"gui\" options\n> in ~/.gitconfig (global) or .git/config (per-repository).  When I\n> split stuff out to git-gui specific files I'll have to migrate the\n> entire \"gui\" section at once.\n\nFWIW I was only concerned about the recent repos, since strictly speaking, \nthey are not options to git-gui...  But I do not care deeply.\n\nCiao,\nDscho\n"}]}