{"thread":{"id":"26430","subject":"[PATCH] git-gui: instead of defaulting to home directory use working directory","startedAt":"2011-02-06T17:22:46Z","lastAt":"2011-02-06T23:01:34Z","messageCount":2,"participants":["Heiko Voigt","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"160502","messageId":"20110206172244.GC47941@book.hvoigt.net","threadId":"26430","inReplyTo":null,"subject":"[PATCH] git-gui: instead of defaulting to home directory use working directory","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2011-02-06T17:22:46Z","receivedAt":"2011-02-06T17:22:46Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"When starting git gui in a non-git directory it presents the user a\ndialog which asks to create, clone or open a repository. The filedialogs\nused to choose the path(s) would always default to the home directory of\nthe user. This patch changes this behavior and uses the current working\ndirectory in which git gui was started as default.\n\nThis is useful in various cases. First being that the user starts the\ngui in some directory and can go search to create, open or clone a\nrepository from there. Another use case is that tools like filemanager\ncontext menues can transport a natural default when selected from a\nfolder.\n\nUsers who like to have their home folder as a default can fall back on\nstarting git gui with its working directory set to the home folder.\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n lib/choose_repository.tcl |   14 +++-----------\n 1 files changed, 3 insertions(+), 11 deletions(-)\n\ndiff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl\nindex fae1192..657f7d5 100644\n--- a/lib/choose_repository.tcl\n+++ b/lib/choose_repository.tcl\n@@ -214,14 +214,6 @@ constructor pick {} {\n \t}\n }\n \n-proc _home {} {\n-\tif {[catch {set h $::env(HOME)}]\n-\t\t|| ![file isdirectory $h]} {\n-\t\tset h .\n-\t}\n-\treturn $h\n-}\n-\n method _center {} {\n \tset nx [winfo reqwidth $top]\n \tset ny [winfo reqheight $top]\n@@ -420,7 +412,7 @@ method _new_local_path {} {\n \tif {$local_path ne {}} {\n \t\tset p [file dirname $local_path]\n \t} else {\n-\t\tset p [_home]\n+\t\tset p [pwd]\n \t}\n \n \tset p [tk_chooseDirectory \\\n@@ -541,7 +533,7 @@ method _open_origin {} {\n \tif {$origin_url ne {} && [file isdirectory $origin_url]} {\n \t\tset p $origin_url\n \t} else {\n-\t\tset p [_home]\n+\t\tset p [pwd]\n \t}\n \n \tset p [tk_chooseDirectory \\\n@@ -1042,7 +1034,7 @@ method _open_local_path {} {\n \tif {$local_path ne {}} {\n \t\tset p $local_path\n \t} else {\n-\t\tset p [_home]\n+\t\tset p [pwd]\n \t}\n \n \tset p [tk_chooseDirectory \\\n-- \n1.7.4.34.gd2cb1\n"},{"id":"160558","messageId":"AANLkTin34B8m-UGkHU80hOZdvBx-os_zDx7yFsHs9caJ@mail.gmail.com","threadId":"26430","inReplyTo":"20110206172244.GC47941@book.hvoigt.net","subject":"Re: [PATCH] git-gui: instead of defaulting to home directory use working directory","fromName":"Pat Thoyts","fromEmail":"patthoyts@gmail.com","sentAt":"2011-02-06T23:01:34Z","receivedAt":"2011-02-06T23:01:34Z","isPatch":true,"sender":{"key":"patthoyts@gmail.com","avatar":"https://gravatar.com/avatar/bee887a777c790bd241f398217723fbe4b854428671db83db32216a28654cb25?d=mp&s=160"},"body":"All three patches are fine - thank you.\n git-gui: instead of defaulting to home directory use working directory\n git-gui: scroll down to default selection for push dialog\n git gui: keep selected branch when remote is changed in push dialog\nall applied.\n"}]}