@matheusbsbs / matheus-bagliano / commits / 7aecb12877
Fork 0

git-gui: properly popup error if gitk should be started but is not installed

On 'Visualize ...', a gitk process is started. Since it is run in the background, catching a possible startup error doesn't work, and the error output goes to the console git-gui is started from. The most probable startup error is that gitk is not installed; so before trying to start, check for the existence of the gitk program, and popup an error message unless it's found. This was noticed and reported by Paul Wise through http://bugs.debian.org/429810 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Gerrit Pape committed Jun 29, 2007 at 11:32 UTC 7aecb128779ffd8258f01f4382df963900ae6acd
1 file changed +5 -3
git-gui.sh
+5 -3
@@ -1042,15 +1042,17 @@ proc do_gitk {revs} {
1042 # lets us bypass using shell process on Windows systems.
1043 #
1044 set cmd [list [info nameofexecutable]]
1045 - lappend cmd [gitexec gitk]
1045 + set exe [gitexec gitk]
1046 + lappend cmd $exe
1047 if {$revs ne {}} {
1048 append cmd { }
1049 append cmd $revs
1050 }
1051
1051 - if {[catch {eval exec $cmd &} err]} {
1052 - error_popup "Failed to start gitk:\n\n$err"
1052 + if {! [file exists $exe]} {
1053 + error_popup "Unable to start gitk:\n\n$exe does not exist"
1054 } else {
1055 + eval exec $cmd &
1056 set ui_status_value $starting_gitk_msg
1057 after 10000 {
1058 if {$ui_status_value eq $starting_gitk_msg} {