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

3 messages from 2005-07-09 to 2005-07-09. Participants: Bryan Larsen.
Thread: https://gitlist.dev/t/1186

## Bryan Larsen, 2005-07-09 10:40

Subject: [PATCH 1/3] add -N option to cg-add (resent)
Message-ID: <20050709104011.26763.37732.sendpatchset@bryan-larsens-ibook-g4.local>
URL: https://gitlist.dev/e/20050709104011.26763.37732.sendpatchset%40bryan-larsens-ibook-g4.local

```
(resending cogito patches)

Add the -N option to cg-add.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 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.XXXXXX) || exit 1
-find "$@" -type f -print0 > $TMPFILE || {
+find "${ARGS[@]}" -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




```

## Bryan Larsen, 2005-07-09 10:40

Subject: [PATCH 2/3] add -N option to cg-commit (resent)
Message-ID: <20050709104024.26763.97362.sendpatchset@bryan-larsens-ibook-g4.local>
URL: https://gitlist.dev/e/20050709104024.26763.97362.sendpatchset%40bryan-larsens-ibook-g4.local
In-Reply-To: <20050709104011.26763.37732.sendpatchset@bryan-larsens-ibook-g4.local>

```
(resending cogito patches)

Add the -N option to cg-add.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 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.XXXXXX) || exit 1
-find "$@" -type f -print0 > $TMPFILE || {
+find "${ARGS[@]}" -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




```

## Bryan Larsen, 2005-07-09 10:40

Subject: [PATCH 3/3] add -N option to cg-init (resent)
Message-ID: <20050709104036.26763.87038.sendpatchset@bryan-larsens-ibook-g4.local>
URL: https://gitlist.dev/e/20050709104036.26763.87038.sendpatchset%40bryan-larsens-ibook-g4.local
In-Reply-To: <20050709104011.26763.37732.sendpatchset@bryan-larsens-ibook-g4.local>

```
(resending cogito patches)

Add the -N option to cg-add.

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---

 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.XXXXXX) || exit 1
-find "$@" -type f -print0 > $TMPFILE || {
+find "${ARGS[@]}" -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




```
