{"thread":{"id":"1209","subject":"[PATCH] cg-commit chokes when given a very large list of files","startedAt":"2005-07-12T11:20:25Z","lastAt":"2005-07-12T11:20:25Z","messageCount":1,"participants":["Bryan Larsen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6031","messageId":"20050712112012.23805.32745.sendpatchset@bryan-larsens-ibook-g4.local","threadId":"1209","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-12T11:20:25Z","receivedAt":"2005-07-12T11:20:25Z","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.  Fix it.\n\nThis patch depends on your filenames not containing line feeds.  No big deal, lots of other parts of cogito break on filenames containing line feeds.\n\nSigned-off-by: Bryan Larsen <bryan.larsen@gmail.com>\n---\n\n cg-commit |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/cg-commit b/cg-commit\n--- a/cg-commit\n+++ b/cg-commit\n@@ -288,10 +288,12 @@ precommit_update () {\n \t\t[ \"$op\" = \"N\" ] || [ \"$op\" = \"D\" ] || [ \"$op\" = \"M\" ] || op=M\n \t\teval \"queue$op[\\${#queue$op[@]}]=\\\"\\$fname\\\"\"\n \tdone\n+\tIFS=$'\\n'\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 | xargs -0 git-update-cache --add ${infoonly} -- ) || return 1; }\n+\t[ \"$queueD\" ] && { ( echo \"${queueD[*]}\" | tr \\\\n \\\\0 | xargs -0 git-update-cache --force-remove -- ) || return 1;  }\n+\t[ \"$queueM\" ] && { ( echo \"${queueM[*]}\" | tr \\\\n \\\\0 | xargs -0 git-update-cache ${infoonly} -- ) || return 1; }\n+\tIFS=$' \\n\\t'\n \treturn 0\n }\n \n"}]}