DORMANTno replies

[PATCH] cg-commit chokes when given a very large list of files

From: Bryan Larsen <hidden>
Date: 2016-06-15 22:42:02
Subsystem: the rest · Maintainer: Linus Torvalds

cg-commit currently chokes when passed a very large list of files.  Fix it.

This patch depends on your filenames not containing line feeds.  No big deal, lots of other parts of cogito break on filenames containing line feeds.

Signed-off-by: Bryan Larsen <redacted>
---

 cg-commit |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -288,10 +288,12 @@ precommit_update () {
 		[ "$op" = "N" ] || [ "$op" = "D" ] || [ "$op" = "M" ] || op=M
 		eval "queue$op[\${#queue$op[@]}]=\"\$fname\""
 	done
+	IFS=$'\n'
 	# XXX: Do we even need to do the --add and --remove update-caches?
-	[ "$queueN" ] && { git-update-cache --add ${infoonly} -- "${queueN[@]}" || return 1; }
-	[ "$queueD" ] && { git-update-cache --force-remove -- "${queueD[@]}" || return 1; }
-	[ "$queueM" ] && { git-update-cache ${infoonly} -- "${queueM[@]}" || return 1; }
+	[ "$queueN" ] && { ( echo "${queueN[*]}" | tr \\n \\0 | xargs -0 git-update-cache --add ${infoonly} -- ) || return 1; }
+	[ "$queueD" ] && { ( echo "${queueD[*]}" | tr \\n \\0 | xargs -0 git-update-cache --force-remove -- ) || return 1;  }
+	[ "$queueM" ] && { ( echo "${queueM[*]}" | tr \\n \\0 | xargs -0 git-update-cache ${infoonly} -- ) || return 1; }
+	IFS=$' \n\t'
 	return 0
 }
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help