threads / patch / 8773

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

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

## tl;dr

One message between Jun 29, 2007 and Jun 29, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Gerrit Pape· Jun 29, 2007, 11:32 UTC · lore

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>
---
 git-gui.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to git-gui.sh +3 −3
diff --git a/git-gui.sh b/git-gui.sh
index 9df2e47..1b0691c 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1070,10 +1070,10 @@ proc do_gitk {revs} {
 		append cmd { }
 		append cmd $revs
 	}
-
-	if {[catch {eval exec $cmd &} err]} {
-		error_popup "Failed to start gitk:\n\n$err"
+	if {! [file exists [gitexec gitk]]} {
+		error_popup "Unable to start gitk:\n\nFile does not exist"
 	} else {
+		eval exec $cmd &
 		set ui_status_value $starting_gitk_msg
 		after 10000 {
 			if {$ui_status_value eq $starting_gitk_msg} {
-- 
1.5.2.1

← back to recent threads