git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Holmsand <holmsand@gmail.com>
To: git@vger.kernel.org
Cc: Petr Baudis <pasky@ucw.cz>
Subject: [PATCH] Make cg-add use xargs -0
Date: Sun, 05 Jun 2005 21:15:38 +0200	[thread overview]
Message-ID: <42A34F5A.2090909@gmail.com> (raw)
In-Reply-To: <20050605184341.GA21345@immutable.crsr.net>

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

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>

[-- Attachment #2: cg-add.patch.txt --]
[-- Type: text/plain, Size: 686 bytes --]

 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

  parent reply	other threads:[~2005-06-05 19:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-05 15:30 cg-init bug Zack Brown
2005-06-05 16:10 ` Radoslaw Szkodzinski
2005-06-05 16:27   ` Zack Brown
2005-06-05 17:59     ` Radoslaw Szkodzinski
2005-06-05 17:28 ` Petr Baudis
2005-06-05 17:56   ` Zack Brown
2005-06-05 18:10     ` Petr Baudis
2005-06-05 18:29       ` cg-init bug -- identified Zack Brown
2005-06-05 18:43         ` Tommy M. McGuire
2005-06-05 19:09           ` Tommy M. McGuire
2005-06-05 19:22             ` [PATCH] " Tommy M. McGuire
2005-06-05 19:15           ` Dan Holmsand [this message]
2005-06-05 20:19         ` Petr Baudis
2005-06-05 23:52           ` cg-init bug -- identified and fixed - thanks! Zack Brown
2005-06-05 21:11         ` cg-init bug -- identified Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42A34F5A.2090909@gmail.com \
    --to=holmsand@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).