[PATCH 3/3] add -N option to cg-init (resent)

2005-07-09 Thread Bryan Larsen
(resending cogito patches)

Add the -N option to cg-add.

Signed-off-by: Bryan Larsen [EMAIL PROTECTED]
---

 cg-add |   21 ++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/cg-add b/cg-add
--- a/cg-add
+++ b/cg-add
@@ -13,20 +13,35 @@
 # is that 'Cogito' manages content and empty directories have no content.
 # Instead, directories are added automatically when adding files inside
 # them.
+#
+# OPTIONS
+# ---
+# -N::
+#   Only update the cache: do not copy the data into the object database.
+#
 
-USAGE=cg-add FILE...
+USAGE=cg-add [-N] FILE...
 
 . ${COGITO_LIB}cg-Xlib
 
 [ $1 ] || usage
 
+infoonly=
+while optparse; do
+   if optparse -N; then
+   infoonly=--info-only
+   else
+   optfail
+   fi
+done
+
 TMPFILE=$(mktemp -t gitadd.XX) || exit 1
-find $@ -type f -print0  $TMPFILE || {
+find [EMAIL PROTECTED] -type f -print0  $TMPFILE || {
die not all files exist, nothing added
rm $TMPFILE
 }
 
 cat $TMPFILE | tr '\0' '\n' | sed 's/^/Adding file /'
-cat $TMPFILE | xargs -0r git-update-cache --add --
+cat $TMPFILE | xargs -0r git-update-cache --add ${infoonly} --
 
 rm $TMPFILE



-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] add -N option to cg-init (resent again)

2005-07-09 Thread Bryan Larsen
(resending cogito patches)

add the -N option to cg-init

Signed-off-by: Bryan Larsen [EMAIL PROTECTED]
---

 cg-init |   22 +++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/cg-init b/cg-init
--- a/cg-init
+++ b/cg-init
@@ -10,13 +10,29 @@
 #
 # If `cg-init` is run in a non-empty directory files in the top and
 # sub directory will automatically be added.
+#
+# OPTIONS
+# ---
+# -N::
+#   Only update the cache: do not copy the data into the object database.
+#
 
-USAGE=cg-init
+USAGE=cg-init [-N]
 _git_repo_unneeded=1
 
 . ${COGITO_LIB}cg-Xlib
 
-uri=$1
+
+infoonly=
+while optparse; do
+   if optparse -N; then
+   infoonly=-N
+   else
+   optfail
+   fi
+done
+
+uri=$ARGV
 
 [ -e $_git ]  die $_git already exists
 
@@ -38,7 +54,7 @@ if [ $uri ]; then
echo Cloned (origin $uri available as branch \origin\)
 else
git-read-tree # Seed the dircache
-   find * \( -type f -o -type l \) -print0 | xargs -0r cg-add
+   find * \( -type f -o -type l \) -print0 | xargs -0r cg-add ${infoonly}
cg-commit -C -mInitial commit -E
 fi
 
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html