[PATCH] Show an error and exit if started in a directory where no .git could be found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is to help people starting gitk from graphical file managers where
the stderr output is hidden.

Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx>
---
 gitk |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index fc7cc8c..f5949a2 100755
--- a/gitk
+++ b/gitk
@@ -7575,7 +7575,10 @@ catch {source ~/.gitk}
 font create optionfont -family sans-serif -size -12
 
 # check that we can find a .git directory somewhere...
-set gitdir [gitdir]
+if {[ catch { set gitdir [gitdir] } ]} {
+    show_error {} . "Cannot find a git repository here."
+    exit 1
+}
 if {![file isdirectory $gitdir]} {
     show_error {} . "Cannot find the git directory \"$gitdir\"."
     exit 1
-- 
1.5.3.rc3.48.g5b618


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux