@matheusbsbs / matheus-bagliano / commits / df128139c6
Fork 0

git-gui: instead of defaulting to home directory use working directory

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> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Heiko Voigt committed Feb 6, 2011 at 18:22 UTC df128139c690233e94ac249cf9d5271ac0d5f13d
1 file changed +3 -11
lib/choose_repository.tcl
+3 -11
@@ -214,14 +214,6 @@ constructor pick {} {
214 }
215 }
216
217 -proc _home {} {
218 - if {[catch {set h $::env(HOME)}]
219 - || ![file isdirectory $h]} {
220 - set h .
221 - }
222 - return $h
223 -}
224 -
217 method _center {} {
218 set nx [winfo reqwidth $top]
219 set ny [winfo reqheight $top]
@@ -420,7 +412,7 @@ method _new_local_path {} {
412 if {$local_path ne {}} {
413 set p [file dirname $local_path]
414 } else {
423 - set p [_home]
415 + set p [pwd]
416 }
417
418 set p [tk_chooseDirectory \
@@ -541,7 +533,7 @@ method _open_origin {} {
533 if {$origin_url ne {} && [file isdirectory $origin_url]} {
534 set p $origin_url
535 } else {
544 - set p [_home]
536 + set p [pwd]
537 }
538
539 set p [tk_chooseDirectory \
@@ -1042,7 +1034,7 @@ method _open_local_path {} {
1034 if {$local_path ne {}} {
1035 set p $local_path
1036 } else {
1045 - set p [_home]
1037 + set p [pwd]
1038 }
1039
1040 set p [tk_chooseDirectory \