{"thread":{"id":"338","subject":"[PATCH] cg-add checks to see if file exists","startedAt":"2005-04-26T22:17:49Z","lastAt":"2005-04-26T22:17:49Z","messageCount":1,"participants":["Rhys Hardwick"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1811","messageId":"200504262317.49739.rhys@rhyshardwick.co.uk","threadId":"338","inReplyTo":null,"subject":"[PATCH] cg-add checks to see if file exists","fromName":"Rhys Hardwick","fromEmail":"rhys@rhyshardwick.co.uk","sentAt":"2005-04-26T22:17:49Z","receivedAt":"2005-04-26T22:17:49Z","isPatch":true,"sender":{"key":"rhys@rhyshardwick.co.uk","avatar":null},"body":"Hi,\n\nThis is a patch to check if the file being added exists, and if not, issues a \nwarning and dies.\n\nRhys\n\n\n\n\nSigned-off-by: Rhys Hardwick <rhys@rhyshardwick.co.uk\n\nIndex: cg-add\n===================================================================\n--- 6159f313b10f0cfcdfedd63d6fb044029fe46aaa/cg-add  (mode:100755 \nsha1:8ba5351a4c7e28a577ea1aa4afa1078c54e9bccc)\n+++ uncommitted/cg-add  (mode:100755)\n@@ -10,4 +10,10 @@\n\n [ \"$1\" ] || die \"usage: cg-add FILE...\"\n\n+if [ -f \"$1\" ]; then\n+       echo \"Adding file $1\"\n+else\n+       die \"$1 does not exist\"\n+fi\n+\n update-cache --add -- \"$@\"\n\n\n"}]}