Git development
 help / color / mirror / Atom feed
From: "C. Cooke" <ccooke@gkhs.net>
To: git@vger.kernel.org
Subject: [COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?)
Date: Wed, 01 Jun 2005 20:22:48 +0100	[thread overview]
Message-ID: <429E0B08.5040603@gkhs.net> (raw)

This is a simple example - giving a nice error if you're in the wrong
directory.

Is this sort of patch wanted? If so, I'm sure I can spare the time to
look into some polishing.

------------------------------
Add some sanity checking - does $_git exist, and is it writable.

---
commit 06afdeefff9fe02cd2a67f223e687646cacf736f
tree cebc55541b89b5370335fc172814feb48456dc85
parent 20e473c9afd8b5d2d549b0e7881473600beb9c37
author C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005 20:03:46 +0100
committer C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005
20:03:46 +0100

 cg-Xnormid |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/cg-Xnormid b/cg-Xnormid
--- a/cg-Xnormid
+++ b/cg-Xnormid
@@ -16,6 +16,15 @@

 id="$1"

+# A little sanity checking.
+if [ ! -d "$_git" ]; then
+       echo "There is no Git repository here ($_git not found)" >&2
+       exit 1
+elif [ ! -r "$_git" ] || [ ! -x "$_git" ]; then
+       echo "You do not have permission to access this git repository" >&2
+       exit 1
+fi
+
 if [ ! "$id" ] || [ "$id" = "this" ] || [ "$id" = "HEAD" ]; then
        read id < "$_git/HEAD"


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

             reply	other threads:[~2005-06-01 19:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-01 19:22 C. Cooke [this message]
2005-06-05 20:25 ` [COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?) Petr Baudis
2005-06-05 20:34   ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=429E0B08.5040603@gkhs.net \
    --to=ccooke@gkhs.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox