{"thread":{"id":"801","subject":"[COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?)","startedAt":"2005-06-01T19:22:48Z","lastAt":"2005-06-05T20:34:22Z","messageCount":3,"participants":["C. Cooke","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4381","messageId":"429E0B08.5040603@gkhs.net","threadId":"801","inReplyTo":null,"subject":"[COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?)","fromName":"C. Cooke","fromEmail":"ccooke@gkhs.net","sentAt":"2005-06-01T19:22:48Z","receivedAt":"2005-06-01T19:22:48Z","isPatch":true,"sender":{"key":"ccooke@gkhs.net","avatar":null},"body":"This is a simple example - giving a nice error if you're in the wrong\ndirectory.\n\nIs this sort of patch wanted? If so, I'm sure I can spare the time to\nlook into some polishing.\n\n------------------------------\nAdd some sanity checking - does $_git exist, and is it writable.\n\n---\ncommit 06afdeefff9fe02cd2a67f223e687646cacf736f\ntree cebc55541b89b5370335fc172814feb48456dc85\nparent 20e473c9afd8b5d2d549b0e7881473600beb9c37\nauthor C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005 20:03:46 +0100\ncommitter C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005\n20:03:46 +0100\n\n cg-Xnormid |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/cg-Xnormid b/cg-Xnormid\n--- a/cg-Xnormid\n+++ b/cg-Xnormid\n@@ -16,6 +16,15 @@\n\n id=\"$1\"\n\n+# A little sanity checking.\n+if [ ! -d \"$_git\" ]; then\n+       echo \"There is no Git repository here ($_git not found)\" >&2\n+       exit 1\n+elif [ ! -r \"$_git\" ] || [ ! -x \"$_git\" ]; then\n+       echo \"You do not have permission to access this git repository\" >&2\n+       exit 1\n+fi\n+\n if [ ! \"$id\" ] || [ \"$id\" = \"this\" ] || [ \"$id\" = \"HEAD\" ]; then\n        read id < \"$_git/HEAD\"\n\n\n______________________________________________________________________\nThis email has been scanned by the MessageLabs Email Security System.\nFor more information please visit http://www.messagelabs.com/email \n______________________________________________________________________\n"},{"id":"4602","messageId":"20050605202527.GO17462@pasky.ji.cz","threadId":"801","inReplyTo":"429E0B08.5040603@gkhs.net","subject":"Re: [COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?)","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-05T20:25:27Z","receivedAt":"2005-06-05T20:25:27Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Jun 01, 2005 at 09:22:48PM CEST, I got a letter\nwhere \"C. Cooke\" <ccooke@gkhs.net> told me that...\n> This is a simple example - giving a nice error if you're in the wrong\n> directory.\n> \n> Is this sort of patch wanted? If so, I'm sure I can spare the time to\n> look into some polishing.\n\nOf course they are wanted. Thanks, applied.\n\n> ------------------------------\n> Add some sanity checking - does $_git exist, and is it writable.\n> \n> ---\n> commit 06afdeefff9fe02cd2a67f223e687646cacf736f\n> tree cebc55541b89b5370335fc172814feb48456dc85\n> parent 20e473c9afd8b5d2d549b0e7881473600beb9c37\n> author C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005 20:03:46 +0100\n> committer C. Cooke <ccooke@slab.earth.gkhs.net> Wed, 01 Jun 2005\n> 20:03:46 +0100\n> \n>  cg-Xnormid |    9 +++++++++\n>  1 files changed, 9 insertions(+), 0 deletions(-)\n> \n> diff --git a/cg-Xnormid b/cg-Xnormid\n> --- a/cg-Xnormid\n> +++ b/cg-Xnormid\n> @@ -16,6 +16,15 @@\n> \n>  id=\"$1\"\n> \n> +# A little sanity checking.\n> +if [ ! -d \"$_git\" ]; then\n> +       echo \"There is no Git repository here ($_git not found)\" >&2\n> +       exit 1\n> +elif [ ! -r \"$_git\" ] || [ ! -x \"$_git\" ]; then\n> +       echo \"You do not have permission to access this git repository\" >&2\n> +       exit 1\n> +fi\n> +\n>  if [ ! \"$id\" ] || [ \"$id\" = \"this\" ] || [ \"$id\" = \"HEAD\" ]; then\n>         read id < \"$_git/HEAD\"\n\nI removed the -r check. What is it good for?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4603","messageId":"20050605203422.GP17462@pasky.ji.cz","threadId":"801","inReplyTo":"20050605202527.GO17462@pasky.ji.cz","subject":"Re: [COGITO PATCH] Small, simple and obvious cleanups (are they wanted at this stage?)","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-05T20:34:22Z","receivedAt":"2005-06-05T20:34:22Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Jun 05, 2005 at 10:25:27PM CEST, I got a letter\nwhere Petr Baudis <pasky@ucw.cz> told me that...\n> Dear diary, on Wed, Jun 01, 2005 at 09:22:48PM CEST, I got a letter\n> where \"C. Cooke\" <ccooke@gkhs.net> told me that...\n> > This is a simple example - giving a nice error if you're in the wrong\n> > directory.\n> > \n> > Is this sort of patch wanted? If so, I'm sure I can spare the time to\n> > look into some polishing.\n> \n> Of course they are wanted. Thanks, applied.\n\nOk, another thing I forgot to mention - I moved it to cg-Xlib so that\nit's checked everytime you run a command, unless the command says it\ndoes need a repository in order to run successfully (that's the case for\ncg-clone, cg-init and cg-help).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"}]}