{"thread":{"id":"411","subject":"[PATCH] cg-add only checks if the first file exists","startedAt":"2005-04-30T16:39:02Z","lastAt":"2005-04-30T16:39:02Z","messageCount":1,"participants":["Andy Lutomirski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2263","messageId":"4273B4A6.10103@myrealbox.com","threadId":"411","inReplyTo":null,"subject":"[PATCH] cg-add only checks if the first file exists","fromName":"Andy Lutomirski","fromEmail":"luto@myrealbox.com","sentAt":"2005-04-30T16:39:02Z","receivedAt":"2005-04-30T16:39:02Z","isPatch":true,"sender":{"key":"luto@myrealbox.com","avatar":null},"body":"[apologies for possible dupe -- my mailer freaked out]\n\nDoing:\ncg-add foo bar\nfails if foo doesn't exist but doesn't check for bar.  It also gives \nmisleading reports to stdout.\n\nI've fixed it at rsync://www.luto.us/cogito.git\n\nPatch attached below as well.\n\n--\nChanged cg-add to check each added file for existence.\n\n---\ncommit 9eb8efee632b6270a436d8088315856712bb5b32\ntree cba76f974b1840640ccfa14b0118e1dc4a704876\nparent 49612c471eebd26efe926a71752e254c1cdc382d\nauthor Andy Lutomirski <luto@myrealbox.com> 1114878247 -0700\ncommitter Andy Lutomirski <luto@myrealbox.com> 1114878247 -0700\n\nIndex: cg-add\n===================================================================\n--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-add  (mode:100755 \nsha1:83f0b13f41599104d741ac91c7aa81497cd37d5f)\n+++ cba76f974b1840640ccfa14b0118e1dc4a704876/cg-add  (mode:100755 \nsha1:c84792450cec279f7b3eb1dec03b69ac07dbe9d9)\n@@ -10,10 +10,12 @@\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+for i in \"$@\"; do\n+       if [ -f \"$i\" ]; then\n+              echo \"Adding file $i\"\n+       else\n+              die \"$i does not exist\"\n+       fi\n+done\n\n  update-cache --add -- \"$@\"\n"}]}