[PATCH] Make cg-add use xargs -0

From: Dan Holmsand <holmsand@gmail.com>
Date: 2005-06-06 05:15:38
Make cg-add use xargs -0, to avoid failure on files with
quotes of all kinds, spaces, etc.

Signed-off-by: Dan Holmsand <holmsand@gmail.com>

 cg-add |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/cg-add b/cg-add
--- a/cg-add
+++ b/cg-add
@@ -19,10 +19,13 @@ USAGE="cg-add FILE..."
 
 [ "$1" ] || usage
 
-TMPFILE=$(mktemp -t gitadd.XXXXXX)
-find "$@" -type f > $TMPFILE || die "not all files exist, nothing added"
+TMPFILE=$(mktemp -t gitadd.XXXXXX) || exit 1
+find "$@" -type f -print0 > $TMPFILE || {
+	die "not all files exist, nothing added"
+	rm $TMPFILE
+}
 
-cat $TMPFILE | awk '{print "Adding file "  $0}'
-cat $TMPFILE | xargs git-update-cache --add --
+cat $TMPFILE | tr \\0 \\n | awk '{print "Adding file "  $0}'
+cat $TMPFILE | xargs -0r git-update-cache --add --
 
 rm $TMPFILE


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Jun 06 05:18:33 2005

This archive was generated by hypermail 2.1.8 : 2005-06-06 05:18:34 EST