git-gui: Reorganized startup procedure to ensure gitdir is right.
Because we cd after getting the cdup value from Git we can't try to get the gitdir until after we perform the cd, as usually the gitdir is relative to the current working directory. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 7, 2006 at 00:20 UTC
b8ce6f0ec8a275bf9e32ff7666d00a88154fd50b
1 file changed
+10
-4
git-gui
+10
-4
@@ -939,7 +939,7 @@ proc error_popup {msg} {
939
}
940
941
proc show_msg {w top msg} {
942
- global gitdir appname
942
+ global gitdir appname mainfont
943
944
message $w.m -text $msg -justify left -aspect 400
945
pack $w.m -side top -fill x -padx 5 -pady 10
@@ -1465,17 +1465,23 @@ unset i M1B M1T
1465
##
1466
## main
1467
1468
-if {[catch {set gitdir [exec git rev-parse --git-dir]} err]} {
1468
+set appname [lindex [file split $argv0] end]
1469
+set gitdir {}
1470
+
1471
+if {[catch {set cdup [exec git rev-parse --show-cdup]} err]} {
1472
show_msg {} . "Cannot find the git directory: $err"
1473
exit 1
1474
}
1472
-set cdup [exec git rev-parse --show-cdup]
1475
if {$cdup != ""} {
1476
cd $cdup
1477
}
1478
unset cdup
1479
1478
-set appname [lindex [file split $argv0] end]
1480
+if {[catch {set gitdir [exec git rev-parse --git-dir]} err]} {
1481
+ show_msg {} . "Cannot find the git directory: $err"
1482
+ exit 1
1483
+}
1484
+
1485
if {$appname == {git-citool}} {
1486
set single_commit 1
1487
}