Re: [COGITO PATCH] Allow file list for cg-add through stdin
Show 5 quoted lines
>But a patch for cg-add processing directories recursively would be great
>anyway... ;-)
>
>
>
Okay, okay, what about this one:
[Cogito PATCH] Add directories recursively with cg-add
Signed-off-by: Jochen Roemling <jochen@roemling.net>
--- a/cg-add
+++ b/cg-add
@@ -10,12 +10,11 @@
[ "$1" ] || die "usage: cg-add FILE..."
-for file in "$@"; do
- if [ -f "$file" ] || [ -h "$file" ]; then
- echo "Adding file $file"
- else
- die "$file does not exist"
- fi
-done
+TMPFILE="${TMP:-/tmp}/$(basename $0).$$.tmp"
-git-update-cache --add -- "$@"
+find $@ -type f > $TMPFILE || die "not all files do exist, nothing added"
+
+cat $TMPFILE | awk '{print "Adding file " $0}'
+cat $TMPFILE | xargs git-update-cache --add --
+
+rm -f $TMPFILE