Re: cg-init bug -- identified
On Sun, Jun 05, 2005 at 01:43:41PM -0500, Tommy M. McGuire wrote:
Show 7 quoted lines
> Adding file foo'prime
> xargs: unmatched single quote
> + cg-commit -C '-mInitial commit' -E
>
> The error is the second-to-last line. It partially succeeded originally
> because xargs broke off and handled parts of the input before reaching
> the single quote.
The bug is in cg-add, which doesn't use -print0 and -0.
--
Tommy McGuire
diff --git a/cg-add b/cg-add
--- a/cg-add
+++ b/cg-add
@@ -20,9 +20,9 @@ USAGE="cg-add FILE..."
[ "$1" ] || usage
TMPFILE=$(mktemp -t gitadd.XXXXXX)
-find "$@" -type f > $TMPFILE || die "not all files exist, nothing added"
+find "$@" -type f -print0 > $TMPFILE || die "not all files exist, nothing added"
-cat $TMPFILE | awk '{print "Adding file " $0}'
-cat $TMPFILE | xargs git-update-cache --add --
+cat $TMPFILE | xargs -0l1 echo "Adding file "
+cat $TMPFILE | xargs -0 git-update-cache --add --
rm $TMPFILE