[COGITO PATCH] Allow file list for cg-add through stdin
From: Jochen Roemling <hidden>
Date: 2016-06-15 22:41:58
|Hello,
how is the preferred way to add a whole new directory to a
git-repository using cogito?
Currently cg-add expects all new files on the command line.
The following patch allows to feed files through stdin, which allows to do
find mynewdir -type f | cg-add -
What about a functionality to specify a directory on the command line
and all files are
recursively added?
Signed-off-by: Jochen Roemling <redacted>
--- a/cg-add 2005-05-29 19:27:17.000000000 +0200
+++ b/cg-add 2005-05-29 19:32:42.000000000 +0200@@ -10,12 +10,24 @@ [ "$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 +if [ "$1" == '-' ]; then + set $@ "" + while read file; do + if [ -f "$file" ] || [ -h "$file" ]; then + echo "Adding file $file" + set $@ "$file" + else + die "$file does not exist" + fi + done +else + for file in "$@"; do + if [ -f "$file" ] || [ -h "$file" ]; then + echo "Adding file $file" + else + die "$file does not exist" + fi + done +fi git-update-cache --add -- "$@"
|