Skip to contentSkip to conversation

Small, simple and obvious cleanups (are they wanted at this stage?)

PATCH In review C. Cooke 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

C. Cooke

author
#0 lore raw

PATCH 1/1 Small, simple and obvious cleanups (are they wanted at this stage?)

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 <[email protected]> Wed, 01 Jun 2005 20:03:46 +0100 committer C. Cooke <[email protected]> Wed, 01 Jun 2005 20:03:46 +0100

 cg-Xnormid |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
cg-Xnormid +9 -0
@@ -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
______________________________________________________________________

#1 lore raw

Dear diary, on Wed, Jun 01, 2005 at 09:22:48PM CEST, I got a letter where "C. Cooke" <[email protected]> told me that...

Quoted 5 lines

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.

Of course they are wanted. Thanks, applied.

Quoted 22 lines

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

---
commit 06afdeefff9fe02cd2a67f223e687646cacf736f
tree cebc55541b89b5370335fc172814feb48456dc85
parent 20e473c9afd8b5d2d549b0e7881473600beb9c37
author C. Cooke <[email protected]> Wed, 01 Jun 2005 20:03:46 +0100 committer C. Cooke <[email protected]> Wed, 01 Jun 2005 20:03:46 +0100

 cg-Xnormid |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
cg-Xnormid +1 -0
@@ -16,6 +16,15 @@
 
 id="$1"
 
+# A little sanity checking.

cg-Xnormid line 29

Quoted 10 lines
cg-Xnormid +8 -0
+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"

I removed the -r check. What is it good for?

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#2 lore raw

Dear diary, on Sun, Jun 05, 2005 at 10:25:27PM CEST, I got a letter where Petr Baudis <[email protected]> told me that...

Quoted 9 lines

Dear diary, on Wed, Jun 01, 2005 at 09:22:48PM CEST, I got a letter where "C. Cooke" <[email protected]> told me that...

Quoted 5 lines

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.

Of course they are wanted. Thanks, applied.

Ok, another thing I forgot to mention - I moved it to cg-Xlib so that it's checked everytime you run a command, unless the command says it does need a repository in order to run successfully (that's the case for cg-clone, cg-init and cg-help).

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor