{"thread":{"id":"22359","subject":"git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch","startedAt":"2010-01-23T19:21:48Z","lastAt":"2010-01-23T22:39:43Z","messageCount":2,"participants":["Christopher Beelby","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"132493","messageId":"564f37c41001231121o10f88b6cwc35a126a0e79d3fc@mail.gmail.com","threadId":"22359","inReplyTo":"564f37c41001231118m3f253259g8876ac4fb2b927c2@mail.gmail.com","subject":"git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch","fromName":"Christopher Beelby","fromEmail":"chris@celabs.com","sentAt":"2010-01-23T19:21:48Z","receivedAt":"2010-01-23T19:21:48Z","isPatch":false,"sender":{"key":"chris@celabs.com","avatar":null},"body":"This patch addresses two issues:\n\n1. When the number of recent repo's gets to ten there can be a\nsituation where an item is removed from the .gitconfig file via\na call to git config --unset, but the internal representation of\nthat file (repo_config(gui.recentrepo)) is not updated. Then a\nsubsequent attempt to remove an item from the list fails because\ngit-gui attempts to call --unset on a value that has already been\nremoved. This leads to duplicates in the .gitconfig file, which\nthen also cause errors if the git-gui tries to --unset them (rather\nthan using --unset-all. --unset-all is not used because it is not\nexpected that duplicates should ever be allowed to exist.)\n\nFor complete step-by-step instructions on how to cause these situations\nin git-gui see my comment on the msysgit project at\nhttp://code.google.com/p/msysgit/issues/detail?id=362&colspec=ID%20Type%20Status%20Priority%20Component%20Owner%20Summary#c9\n\n2. When loading the list of recent repositories (proc _get_recentrepos)\nif a repo in the list is not considered a valid git reposoitory\nthen we should go ahead and remove it so it doesn't take up a slot\nin the list (since we limit to 10 items). This will prevent a bunch of\ninvalid entries in the list (which are not shown) from making valid\nentries dissapear off the list even when there are less than ten valid\nentries.\n\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex 633cc57..3f8f303 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -235,6 +235,8 @@ proc _get_recentrepos {} {\n \tforeach p [get_config gui.recentrepo] {\n \t\tif {[_is_git [file join $p .git]]} {\n \t\t\tlappend recent $p\n+\t\t} else {\n+\t\t\t_unset_recentrepo $p\n \t\t}\n \t}\n \treturn [lsort $recent]\n@@ -243,6 +245,7 @@ proc _get_recentrepos {} {\n proc _unset_recentrepo {p} {\n \tregsub -all -- {([()\\[\\]{}\\.^$+*?\\\\])} $p {\\\\\\1} p\n \tgit config --global --unset gui.recentrepo \"^$p\\$\"\n+\tload_config 1\n }\n \n proc _append_recentrepos {path} {\n@@ -261,6 +264,7 @@ proc _append_recentrepos {path} {\n \n \tlappend recent $path\n \tgit config --global --add gui.recentrepo $path\n+\tload_config 1\n \n \twhile {[llength $recent] > 10} {\n \t\t_unset_recentrepo [lindex $recent 0]\n"},{"id":"132511","messageId":"20100123223943.GC12679@spearce.org","threadId":"22359","inReplyTo":"564f37c41001231121o10f88b6cwc35a126a0e79d3fc@mail.gmail.com","subject":"Re: git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-01-23T22:39:43Z","receivedAt":"2010-01-23T22:39:43Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Christopher Beelby <chris@celabs.com> wrote:\n> This patch addresses two issues:\n\nThanks, applied.  In the future please follow the SubmittingPatches\nguidelines, which includes sending the patch inline in your message\nusing the formatting created by `git format-patch`.\n \n-- \nShawn.\n"}]}