git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 29, 2007, 20:29 UTC
Message-ID
<20070729202945.GB9362@steel.home>

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

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 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
Message 1 of 1 in “Show an error and exit if started in a directory where no .git could be found”
  1. Show an error and exit if started in a directory where no .git could be foundAlex Riesen, Jul 29, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.