{"thread":{"id":"605","subject":"[PATCH 2/2] update cg-* to use cg-Xignore","startedAt":"2005-05-13T22:32:22Z","lastAt":"2005-05-14T15:14:28Z","messageCount":6,"participants":["David Greaves","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"3257","messageId":"E1DWihi-0007DQ-SD@ash.dgreaves.com","threadId":"605","inReplyTo":null,"subject":"[PATCH 2/2] update cg-* to use cg-Xignore","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-13T22:32:22Z","receivedAt":"2005-05-13T22:32:22Z","isPatch":true,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Updated\n    cg-add\n    cg-commit\n    cg-init\n    cg-status\nto use the cg-Xignore\n\nSigned-off-by: David Greaves <david@dgreaves.com>\n\n---\ncommit 80e8dbdd3cf5e8d4ca0b6e446911d1ac17c5064e\ntree 03662df7d089d4a84987ef9edb50a017b8b42439\nparent 2fca920e6d3ccb92e9782bcf02f860b8333e23d9\nauthor David Greaves <david@dgreaves.com> Fri, 13 May 2005 23:18:20 +0100\ncommitter David Greaves <david@ash.(none)> Fri, 13 May 2005 23:18:20 +0100\n\n cg-add    |   13 +++++--------\n cg-commit |    9 +++++++++\n cg-init   |    7 ++++++-\n cg-status |   14 ++------------\n 4 files changed, 22 insertions(+), 21 deletions(-)\n\nIndex: cg-add\n===================================================================\n--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-add  (mode:100755)\n+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-add  (mode:100755)\n@@ -11,11 +11,8 @@\n [ \"$1\" ] || die \"usage: cg-add FILE...\"\n \n for file in \"$@\"; do\n-\tif [ -f \"$file\" ] || [ -h \"$file\" ]; then\n-\t\techo \"Adding file $file\"\n-\telse\n-\t\tdie \"$file does not exist\"\n-\tfi\n-done\n-\n-git-update-cache --add -- \"$@\"\n+    if [ -f \"$file\" ] || [ -h \"$file\" ]; then\n+\techo \"Adding file $file\" >&2\n+    fi\n+    echo \"$file\"\n+done | cg-Xignore -f -h | xargs git-update-cache --add --\nIndex: cg-commit\n===================================================================\n--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit  (mode:100755)\n+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit  (mode:100755)\n@@ -65,6 +65,15 @@\n \t[ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')\n fi\n \n+# strip ignored files - *1 at a time* - any attempt to stream from 1\n+# while loop to another uses a subprocess and can't pass the variable\n+# back\n+# Also I don't know if this can be put in a shell function\n+for file in ${commitfiles[@]}\n+  do\n+  commitfiles[$i]=`echo $file | cg-Xignore`\n+  ((i++))\n+done\n \n LOGMSG=$(mktemp -t gitci.XXXXXX)\n LOGMSG2=$(mktemp -t gitci.XXXXXX)\nIndex: cg-init\n===================================================================\n--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-init  (mode:100755)\n+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-init  (mode:100755)\n@@ -7,6 +7,9 @@\n # remote repository. Note that this usage is DEPRECATED - use cg-clone\n # (possibly with the -s parameter) for doing this. This functionality\n # will go away from cg-init soon.\n+#\n+# if there is a file called cogito.ignore then it is used to prime the\n+# .git/ignore patterns\n \n . ${COGITO_LIB}cg-Xlib\n \n@@ -19,6 +22,8 @@\n touch $_git/refs/heads/master\n ln -s refs/heads/master $_git/HEAD\n \n+[ -f cogito.ignore ] && mv cogito.ignore .git/ignore\n+\n if [ \"$uri\" ]; then\n \techo \"$uri\" >$_git/branches/origin\n \tcg-pull origin || die \"pull failed\"\n@@ -31,7 +36,7 @@\n \techo \"Cloned (origin $uri available as branch \\\"origin\\\")\"\n else\n \tgit-read-tree # Seed the dircache\n-\tfind * -type f | xargs cg-add\n+\tfind * | cg-Xignore -f -h | xargs cg-add\n \tcg-commit -C -m\"Initial commit\" -e\n fi\n exit 0\nIndex: cg-status\n===================================================================\n--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status  (mode:100755)\n+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status  (mode:100755)\n@@ -15,21 +15,11 @@\n \n {\n \tgit-ls-files -z -t --others --deleted --unmerged $EXCLUDE\n-} | sort -z -k 2 | xargs -0 sh -c '\n-while [ \"$1\" ]; do\n-\ttag=${1% *};\n-\tfilename=${1#* };\n-\tcase \"$filename\" in\n-\t*.[ao] | tags | ,,merge*) ;;\n-\t*)   echo \"$tag $filename\";;\n-\tesac\n-\tshift\n-done\n-' padding\n+} | sort -z -k 2 | cg-Xignore -0 -t | tr \"\\000\" \"\\n\"\n \n {\n \tgit-update-cache --refresh\n-} | cut -f 1 -d \":\" | xargs sh -c '\n+} | cut -f 1 -d \":\" | cg-Xignore | xargs sh -c '\n while [ \"$1\" ]; do\n \ttag=\"M\";\n \tfilename=${1%: *};\n"},{"id":"3259","messageId":"20050513225516.GG32232@pasky.ji.cz","threadId":"605","inReplyTo":"E1DWihi-0007DQ-SD@ash.dgreaves.com","subject":"Re: [PATCH 2/2] update cg-* to use cg-Xignore","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-13T22:55:17Z","receivedAt":"2005-05-13T22:55:17Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Updated\n>     cg-add\n>     cg-commit\n\nI consider this Bad Thing (tm). Or could you please point a situation\nwhere this would be actually useful? If you explicitly cg-add, you\nlikely know what are you doing, and same thing with cg-commit - if it's\nalready added, it should be watches, no matter what ignore patterns, I\nthink.\n> --- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit  (mode:100755)\n> +++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit  (mode:100755)\n> @@ -65,6 +65,15 @@\n>  \t[ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')\n>  fi\n>  \n> +# strip ignored files - *1 at a time* - any attempt to stream from 1\n> +# while loop to another uses a subprocess and can't pass the variable\n> +# back\n> +# Also I don't know if this can be put in a shell function\n> +for file in ${commitfiles[@]}\n> +  do\n> +  commitfiles[$i]=`echo $file | cg-Xignore`\n> +  ((i++))\n> +done\n>  \n>  LOGMSG=$(mktemp -t gitci.XXXXXX)\n>  LOGMSG2=$(mktemp -t gitci.XXXXXX)\n\nThe variable? What variable?\n\n> Index: cg-status\n> ===================================================================\n> --- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status  (mode:100755)\n> +++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status  (mode:100755)\n> @@ -15,21 +15,11 @@\n>  \n>  {\n>  \tgit-ls-files -z -t --others --deleted --unmerged $EXCLUDE\n> -} | sort -z -k 2 | xargs -0 sh -c '\n> -while [ \"$1\" ]; do\n> -\ttag=${1% *};\n> -\tfilename=${1#* };\n> -\tcase \"$filename\" in\n> -\t*.[ao] | tags | ,,merge*) ;;\n> -\t*)   echo \"$tag $filename\";;\n> -\tesac\n> -\tshift\n> -done\n> -' padding\n> +} | sort -z -k 2 | cg-Xignore -0 -t | tr \"\\000\" \"\\n\"\n\nSo you have two ignores now - exclude and Xignore.\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":"3290","messageId":"4285B5CA.8060106@dgreaves.com","threadId":"605","inReplyTo":"20050513225516.GG32232@pasky.ji.cz","subject":"Re: [PATCH 2/2] update cg-* to use cg-Xignore","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-14T08:24:42Z","receivedAt":"2005-05-14T08:24:42Z","isPatch":true,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Petr Baudis wrote:\n\n>Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter\n>where David Greaves <david@dgreaves.com> told me that...\n>  \n>\n>>Updated\n>>    cg-add\n>>    cg-commit\n>>    \n>>\n>\n>I consider this Bad Thing (tm). Or could you please point a situation\n>where this would be actually useful? If you explicitly cg-add, you\n>likely know what are you doing, and same thing with cg-commit - if it's\n>already added, it should be watches, no matter what ignore patterns, I\n>think.\n>  \n>\nOK, lets say I'm clever and know what an ignore pattern is.\nI can\nfind * | xargs cg-add\nmy laziness something my hubris acknowledges :)\n\nAnd in fact this has come up a few times on the list already - it was\nthat code snippet in cg-init that caused me to create cg-Xignore because\nas someone pointed out, even finding files/links would still cause probs\nwith files beginning with '.'\ndoes that sway you?\n\n>>--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit  (mode:100755)\n>>+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit  (mode:100755)\n>>@@ -65,6 +65,15 @@\n>> \t[ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')\n>> fi\n>> \n>>+# strip ignored files - *1 at a time* - any attempt to stream from 1\n>>+# while loop to another uses a subprocess and can't pass the variable\n>>+# back\n>>+# Also I don't know if this can be put in a shell function\n>>+for file in ${commitfiles[@]}\n>>+  do\n>>+  commitfiles[$i]=`echo $file | cg-Xignore`\n>>+  ((i++))\n>>+done\n>> \n>> LOGMSG=$(mktemp -t gitci.XXXXXX)\n>> LOGMSG2=$(mktemp -t gitci.XXXXXX)\n>>    \n>>\n>\n>The variable? What variable?\n>  \n>\nwell basically we want to edit the commitfiles variable - perl map()\na more efficient method in shell appears to be:\nforeach file in commitfiles; echo file | filter | read into commitfiles\nI spent ages trying not to exec a cg-Ignore process per file comparison\n\n>>Index: cg-status\n>>===================================================================\n>>--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status  (mode:100755)\n>>+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status  (mode:100755)\n>>@@ -15,21 +15,11 @@\n>> \n>> {\n>> \tgit-ls-files -z -t --others --deleted --unmerged $EXCLUDE\n>>-} | sort -z -k 2 | xargs -0 sh -c '\n>>-while [ \"$1\" ]; do\n>>-\ttag=${1% *};\n>>-\tfilename=${1#* };\n>>-\tcase \"$filename\" in\n>>-\t*.[ao] | tags | ,,merge*) ;;\n>>-\t*)   echo \"$tag $filename\";;\n>>-\tesac\n>>-\tshift\n>>-done\n>>-' padding\n>>+} | sort -z -k 2 | cg-Xignore -0 -t | tr \"\\000\" \"\\n\"\n>>    \n>>\n>\n>So you have two ignores now - exclude and Xignore.\n>  \n>\nNo, cogito has an ignore.\ngit has a less powerful exclude.\ncogito users won't need exclude but power-users aren't barred from it.\n\n\nDavid\n\n-- \n\n"},{"id":"3304","messageId":"20050514121846.GE3905@pasky.ji.cz","threadId":"605","inReplyTo":"4285B5CA.8060106@dgreaves.com","subject":"Re: [PATCH 2/2] update cg-* to use cg-Xignore","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-14T12:18:46Z","receivedAt":"2005-05-14T12:18:46Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Petr Baudis wrote:\n> \n> >Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter\n> >where David Greaves <david@dgreaves.com> told me that...\n> >  \n> >\n> >>Updated\n> >>    cg-add\n> >>    cg-commit\n> >>    \n> >>\n> >\n> >I consider this Bad Thing (tm). Or could you please point a situation\n> >where this would be actually useful? If you explicitly cg-add, you\n> >likely know what are you doing, and same thing with cg-commit - if it's\n> >already added, it should be watches, no matter what ignore patterns, I\n> >think.\n> >  \n> >\n> OK, lets say I'm clever and know what an ignore pattern is.\n> I can\n> find * | xargs cg-add\n> my laziness something my hubris acknowledges :)\n\nMakes sense, ok.\n\nWhat about cg-commit? You already even added it.\n\n> >>Index: cg-status\n> >>===================================================================\n> >>--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status  (mode:100755)\n> >>+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status  (mode:100755)\n> >>@@ -15,21 +15,11 @@\n> >> \n> >> {\n> >> \tgit-ls-files -z -t --others --deleted --unmerged $EXCLUDE\n> >>-} | sort -z -k 2 | xargs -0 sh -c '\n> >>-while [ \"$1\" ]; do\n> >>-\ttag=${1% *};\n> >>-\tfilename=${1#* };\n> >>-\tcase \"$filename\" in\n> >>-\t*.[ao] | tags | ,,merge*) ;;\n> >>-\t*)   echo \"$tag $filename\";;\n> >>-\tesac\n> >>-\tshift\n> >>-done\n> >>-' padding\n> >>+} | sort -z -k 2 | cg-Xignore -0 -t | tr \"\\000\" \"\\n\"\n> >>    \n> >>\n> >\n> >So you have two ignores now - exclude and Xignore.\n> >  \n> >\n> No, cogito has an ignore.\n> git has a less powerful exclude.\n> cogito users won't need exclude but power-users aren't barred from it.\n\nI think having two essentially redundant things is useless. But you'll\nbe able to use the --exclude powers now since you have to fall back to\ngood ol' globs.\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":"3310","messageId":"42860EB0.9000105@dgreaves.com","threadId":"605","inReplyTo":"20050514121846.GE3905@pasky.ji.cz","subject":"Re: [PATCH 2/2] update cg-* to use cg-Xignore","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-14T14:44:00Z","receivedAt":"2005-05-14T14:44:00Z","isPatch":true,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Petr Baudis wrote:\n\n>Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter\n>where David Greaves <david@dgreaves.com> told me that...\n>  \n>\n>>Petr Baudis wrote:\n>>    \n>>\n>Makes sense, ok.\n>\n>What about cg-commit? You already even added it.\n>  \n>\n\nI'd use the same argument - you want to commit files changed in a directory:\nfind src | xargs cg-commit\nfind Documentation | xargs cg-commit\n\nI agree it's less compelling.\nI admit I was primarily just making sure that all cg-* commands behaved\nthe same way.\nI also don't have an ignore-override - do you think we need one?\n\n>>No, cogito has an ignore.\n>>git has a less powerful exclude.\n>>cogito users won't need exclude but power-users aren't barred from it.\n>>    \n>>\n>\n>I think having two essentially redundant things is useless. But you'll\n>be able to use the --exclude powers now since you have to fall back to\n>good ol' globs.\n>  \n>\nunless...\n\n-- \n\n"},{"id":"3316","messageId":"20050514151428.GM3905@pasky.ji.cz","threadId":"605","inReplyTo":"42860EB0.9000105@dgreaves.com","subject":"Re: [PATCH 2/2] update cg-* to use cg-Xignore","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-14T15:14:28Z","receivedAt":"2005-05-14T15:14:28Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, May 14, 2005 at 04:44:00PM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Petr Baudis wrote:\n> \n> >Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter\n> >where David Greaves <david@dgreaves.com> told me that...\n> >  \n> >\n> >>Petr Baudis wrote:\n> >>    \n> >>\n> >Makes sense, ok.\n> >\n> >What about cg-commit? You already even added it.\n> >  \n> >\n> \n> I'd use the same argument - you want to commit files changed in a directory:\n> find src | xargs cg-commit\n> find Documentation | xargs cg-commit\n> I agree it's less compelling.\n> I admit I was primarily just making sure that all cg-* commands behaved\n> the same way.\n\nThinking about it, I think we can actually live with it. I agree that\nit's more consistent.\n\n> I also don't have an ignore-override - do you think we need one?\n\nI'd prefer CVS-like format. That is, lines starting with ! are\nexceptions to previous ignore rules.\n\n> >>No, cogito has an ignore.\n> >>git has a less powerful exclude.\n> >>cogito users won't need exclude but power-users aren't barred from it.\n> >>    \n> >>\n> >\n> >I think having two essentially redundant things is useless. But you'll\n> >be able to use the --exclude powers now since you have to fall back to\n> >good ol' globs.\n> >  \n> >\n> unless...\n\nSee my other mail that I'd prefer globs as the main ignoring mechanism\nanyway. ;-)\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"}]}