threads / patch / 1172

patch5/7 Add the -N option to cg-add.

Subject: [PATCH] 5/7 Add the -N option to cg-add.

## tl;dr

One message between Jul 8, 2005 and Jul 8, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Bryan Larsen· Jul 8, 2005, 10:54 UTC · lore
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(-)
Show changes to cg-add +18 −3
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




← back to recent threads