{"thread":{"id":"1271","subject":"[PATCH] cg-commit chokes when given a very large list of files","startedAt":"2005-07-18T03:18:13Z","lastAt":"2005-07-18T03:29:41Z","messageCount":2,"participants":["Bryan Larsen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6235","messageId":"20050718031808.20247.43698.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1271","inReplyTo":null,"subject":"[PATCH] cg-commit chokes when given a very large list of files","fromName":"Bryan Larsen","fromEmail":"bryanlarsen@yahoo.com","sentAt":"2005-07-18T03:18:13Z","receivedAt":"2005-07-18T03:18:13Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"cg-commit currently chokes when passed a very large list of files.\nFix it.\n\nThis patch depends on your filenames not containing line feeds.  No\nbig deal, other parts of cogito break on filenames containing line\nfeeds.\n\nResent because previous send appears to have been dropped.  This patch\nis cleaner.\n\nSigned-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\n cg-commit |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/cg-commit b/cg-commit\n--- a/cg-commit\n+++ b/cg-commit\n@@ -289,9 +289,9 @@ precommit_update () {\n \t\teval \"queue$op[\\${#queue$op[@]}]=\\\"\\$fname\\\"\"\n \tdone\n \t# XXX: Do we even need to do the --add and --remove update-caches?\n-\t[ \"$queueN\" ] && { git-update-cache --add ${infoonly} -- \"${queueN[@]}\" || return 1; }\n-\t[ \"$queueD\" ] && { git-update-cache --force-remove -- \"${queueD[@]}\" || return 1; }\n-\t[ \"$queueM\" ] && { git-update-cache ${infoonly} -- \"${queueM[@]}\" || return 1; }\n+\t[ \"$queueN\" ] && { ( echo \"${queueN[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache --add ${infoonly} -- ) || return 1; }\n+\t[ \"$queueD\" ] && { ( echo \"${queueD[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache --force-remove -- ) || return 1;  }\n+\t[ \"$queueM\" ] && { ( echo \"${queueM[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache ${infoonly} -- ) || return 1; }\n \treturn 0\n }\n \n"},{"id":"6236","messageId":"42DB2225.2070207@gmail.com","threadId":"1271","inReplyTo":"20050718031808.20247.43698.sendpatchset@bryan-larsens-ibook-g4.local","subject":"Re: [PATCH] cg-commit chokes when given a very large list of files","fromName":"Bryan Larsen","fromEmail":"bryan.larsen@gmail.com","sentAt":"2005-07-18T03:29:41Z","receivedAt":"2005-07-18T03:29:41Z","isPatch":true,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"This patch is broken.  The original patch still works.\n\nBryan\n\n\nBryan Larsen wrote:\n> cg-commit currently chokes when passed a very large list of files.\n> Fix it.\n> \n> This patch depends on your filenames not containing line feeds.  No\n> big deal, other parts of cogito break on filenames containing line\n> feeds.\n> \n> Resent because previous send appears to have been dropped.  This patch\n> is cleaner.\n> \n> Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n> ---\n> \n>  cg-commit |    6 +++---\n>  1 files changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/cg-commit b/cg-commit\n> --- a/cg-commit\n> +++ b/cg-commit\n> @@ -289,9 +289,9 @@ precommit_update () {\n>  \t\teval \"queue$op[\\${#queue$op[@]}]=\\\"\\$fname\\\"\"\n>  \tdone\n>  \t# XXX: Do we even need to do the --add and --remove update-caches?\n> -\t[ \"$queueN\" ] && { git-update-cache --add ${infoonly} -- \"${queueN[@]}\" || return 1; }\n> -\t[ \"$queueD\" ] && { git-update-cache --force-remove -- \"${queueD[@]}\" || return 1; }\n> -\t[ \"$queueM\" ] && { git-update-cache ${infoonly} -- \"${queueM[@]}\" || return 1; }\n> +\t[ \"$queueN\" ] && { ( echo \"${queueN[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache --add ${infoonly} -- ) || return 1; }\n> +\t[ \"$queueD\" ] && { ( echo \"${queueD[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache --force-remove -- ) || return 1;  }\n> +\t[ \"$queueM\" ] && { ( echo \"${queueM[*]}\" | tr \\\\n \\\\0 | IFS=$'\\n' xargs -0 git-update-cache ${infoonly} -- ) || return 1; }\n>  \treturn 0\n>  }\n>  \n> \n"}]}