git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cg-commit chokes when given a very large list of files
@ 2005-07-18  3:18 Bryan Larsen
  2005-07-18  3:29 ` Bryan Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan Larsen @ 2005-07-18  3:18 UTC (permalink / raw)
  To: bryan.larsen; +Cc: Bryan Larsen, pasky, git

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, other parts of cogito break on filenames containing line
feeds.

Resent because previous send appears to have been dropped.  This patch
is cleaner.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 cg-commit |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -289,9 +289,9 @@ precommit_update () {
 		eval "queue$op[\${#queue$op[@]}]=\"\$fname\""
 	done
 	# 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 | IFS=$'\n' xargs -0 git-update-cache --add ${infoonly} -- ) || return 1; }
+	[ "$queueD" ] && { ( echo "${queueD[*]}" | tr \\n \\0 | IFS=$'\n' xargs -0 git-update-cache --force-remove -- ) || return 1;  }
+	[ "$queueM" ] && { ( echo "${queueM[*]}" | tr \\n \\0 | IFS=$'\n' xargs -0 git-update-cache ${infoonly} -- ) || return 1; }
 	return 0
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] cg-commit chokes when given a very large list of files
@ 2005-07-12 11:20 Bryan Larsen
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan Larsen @ 2005-07-12 11:20 UTC (permalink / raw)
  To: bryan.larsen; +Cc: Bryan Larsen, pasky, git

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 <bryan.larsen@gmail.com>
---

 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
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-18  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18  3:18 [PATCH] cg-commit chokes when given a very large list of files Bryan Larsen
2005-07-18  3:29 ` Bryan Larsen
  -- strict thread matches above, loose matches on Subject: below --
2005-07-12 11:20 Bryan Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).