From: Jochen Roemling Date: Sun, 29 May 2005 20:22:57 GMT Subject: Re: [COGITO PATCH] Allow file list for cg-add through stdin Message-ID: <429A24A1.1010402@roemling.net> In-Reply-To: <20050529184642.GL1036@pasky.ji.cz> Petr Baudis wrote: >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 --- 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