Skip to contentSkip to conversation

7/7 add -N option to cg-init

PATCH New Bryan Larsen 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 7/7 add -N option to cg-init

add -N option to cg-init

---

 cg-init |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
cg-init +19 -3
@@ -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 -m"Initial commit" -E
 fi