git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in  synch
       [not found] <564f37c41001231118m3f253259g8876ac4fb2b927c2@mail.gmail.com>
@ 2010-01-23 19:21 ` Christopher Beelby
  2010-01-23 22:39   ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Beelby @ 2010-01-23 19:21 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]

This patch addresses two issues:

1. When the number of recent repo's gets to ten there can be a
situation where an item is removed from the .gitconfig file via
a call to git config --unset, but the internal representation of
that file (repo_config(gui.recentrepo)) is not updated. Then a
subsequent attempt to remove an item from the list fails because
git-gui attempts to call --unset on a value that has already been
removed. This leads to duplicates in the .gitconfig file, which
then also cause errors if the git-gui tries to --unset them (rather
than using --unset-all. --unset-all is not used because it is not
expected that duplicates should ever be allowed to exist.)

For complete step-by-step instructions on how to cause these situations
in git-gui see my comment on the msysgit project at
http://code.google.com/p/msysgit/issues/detail?id=362&colspec=ID%20Type%20Status%20Priority%20Component%20Owner%20Summary#c9

2. When loading the list of recent repositories (proc _get_recentrepos)
if a repo in the list is not considered a valid git reposoitory
then we should go ahead and remove it so it doesn't take up a slot
in the list (since we limit to 10 items). This will prevent a bunch of
invalid entries in the list (which are not shown) from making valid
entries dissapear off the list even when there are less than ten valid
entries.

[-- Attachment #2: patch1.patch --]
[-- Type: application/octet-stream, Size: 875 bytes --]

diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl
index 633cc57..3f8f303 100644
--- a/git-gui/lib/choose_repository.tcl
+++ b/git-gui/lib/choose_repository.tcl
@@ -235,6 +235,8 @@ proc _get_recentrepos {} {
 	foreach p [get_config gui.recentrepo] {
 		if {[_is_git [file join $p .git]]} {
 			lappend recent $p
+		} else {
+			_unset_recentrepo $p
 		}
 	}
 	return [lsort $recent]
@@ -243,6 +245,7 @@ proc _get_recentrepos {} {
 proc _unset_recentrepo {p} {
 	regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p
 	git config --global --unset gui.recentrepo "^$p\$"
+	load_config 1
 }
 
 proc _append_recentrepos {path} {
@@ -261,6 +264,7 @@ proc _append_recentrepos {path} {
 
 	lappend recent $path
 	git config --global --add gui.recentrepo $path
+	load_config 1
 
 	while {[llength $recent] > 10} {
 		_unset_recentrepo [lindex $recent 0]

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

* Re: git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch
  2010-01-23 19:21 ` git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch Christopher Beelby
@ 2010-01-23 22:39   ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2010-01-23 22:39 UTC (permalink / raw)
  To: Christopher Beelby; +Cc: git

Christopher Beelby <chris@celabs.com> wrote:
> This patch addresses two issues:

Thanks, applied.  In the future please follow the SubmittingPatches
guidelines, which includes sending the patch inline in your message
using the formatting created by `git format-patch`.
 
-- 
Shawn.

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

end of thread, other threads:[~2010-01-23 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <564f37c41001231118m3f253259g8876ac4fb2b927c2@mail.gmail.com>
2010-01-23 19:21 ` git-gui PATCH Keep repo_config(gui.recentrepos) and .gitconfig in synch Christopher Beelby
2010-01-23 22:39   ` 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).