All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-gui: instead of defaulting to home directory use working directory
@ 2011-02-06 17:22 Heiko Voigt
  2011-02-06 23:01 ` Pat Thoyts
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Voigt @ 2011-02-06 17:22 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Jens Lehmann, git

When starting git gui in a non-git directory it presents the user a
dialog which asks to create, clone or open a repository. The filedialogs
used to choose the path(s) would always default to the home directory of
the user. This patch changes this behavior and uses the current working
directory in which git gui was started as default.

This is useful in various cases. First being that the user starts the
gui in some directory and can go search to create, open or clone a
repository from there. Another use case is that tools like filemanager
context menues can transport a natural default when selected from a
folder.

Users who like to have their home folder as a default can fall back on
starting git gui with its working directory set to the home folder.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 lib/choose_repository.tcl |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index fae1192..657f7d5 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -214,14 +214,6 @@ constructor pick {} {
 	}
 }
 
-proc _home {} {
-	if {[catch {set h $::env(HOME)}]
-		|| ![file isdirectory $h]} {
-		set h .
-	}
-	return $h
-}
-
 method _center {} {
 	set nx [winfo reqwidth $top]
 	set ny [winfo reqheight $top]
@@ -420,7 +412,7 @@ method _new_local_path {} {
 	if {$local_path ne {}} {
 		set p [file dirname $local_path]
 	} else {
-		set p [_home]
+		set p [pwd]
 	}
 
 	set p [tk_chooseDirectory \
@@ -541,7 +533,7 @@ method _open_origin {} {
 	if {$origin_url ne {} && [file isdirectory $origin_url]} {
 		set p $origin_url
 	} else {
-		set p [_home]
+		set p [pwd]
 	}
 
 	set p [tk_chooseDirectory \
@@ -1042,7 +1034,7 @@ method _open_local_path {} {
 	if {$local_path ne {}} {
 		set p $local_path
 	} else {
-		set p [_home]
+		set p [pwd]
 	}
 
 	set p [tk_chooseDirectory \
-- 
1.7.4.34.gd2cb1

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

* Re: [PATCH] git-gui: instead of defaulting to home directory use working directory
  2011-02-06 17:22 [PATCH] git-gui: instead of defaulting to home directory use working directory Heiko Voigt
@ 2011-02-06 23:01 ` Pat Thoyts
  0 siblings, 0 replies; 2+ messages in thread
From: Pat Thoyts @ 2011-02-06 23:01 UTC (permalink / raw)
  To: Heiko Voigt; +Cc: Pat Thoyts, Jens Lehmann, git

All three patches are fine - thank you.
 git-gui: instead of defaulting to home directory use working directory
 git-gui: scroll down to default selection for push dialog
 git gui: keep selected branch when remote is changed in push dialog
all applied.

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

end of thread, other threads:[~2011-02-06 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06 17:22 [PATCH] git-gui: instead of defaulting to home directory use working directory Heiko Voigt
2011-02-06 23:01 ` Pat Thoyts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.