# [PATCH 2/3] add -N option to cg-commit (resent again)

3 messages from 2005-07-09 to 2005-07-10. Participants: Bryan Larsen, Petr Baudis.
Thread: https://gitlist.dev/t/1187

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

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

```
(resending cogito patches)

Add the -N option to cg-commit.

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

 cg-commit |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -39,6 +39,10 @@
 #	the tree is the same as the last time you committed, no changes
 #	happenned.
 #
+# -N::
+#   Don't add the files to the object database, just update the caches
+#   and the commit information.
+#
 # FILES
 # -----
 # $GIT_DIR/author::
@@ -103,11 +107,16 @@ fi
 force=
 forceeditor=
 ignorecache=
+infoonly=
 commitalways=
+nocheck=
 msgs=()
 while optparse; do
 	if optparse -C; then
 		ignorecache=1
+	elif optparse -N; then
+		nocheck=--no-check
+		infoonly=--info-only
 	elif optparse -e; then
 		forceeditor=1
 	elif optparse -E; then
@@ -278,9 +287,9 @@ precommit_update () {
 		eval "queue$op[\${#queue$op[@]}]=\"\$fname\""
 	done
 	# XXX: Do we even need to do the --add and --remove update-caches?
-	[ "$queueN" ] && { git-update-cache --add -- "${queueN[@]}" || return 1; }
+	[ "$queueN" ] && { git-update-cache --add ${infoonly} -- "${queueN[@]}" || return 1; }
 	[ "$queueD" ] && { git-update-cache --force-remove -- "${queueD[@]}" || return 1; }
-	[ "$queueM" ] && { git-update-cache -- "${queueM[@]}" || return 1; }
+	[ "$queueM" ] && { git-update-cache ${infoonly} -- "${queueM[@]}" || return 1; }
 	return 0
 }
 
@@ -300,7 +309,7 @@ if [ -s "$_git/HEAD" ]; then
 	oldheadstr="-p $oldhead"
 fi
 
-treeid=$(git-write-tree)
+treeid=$(git-write-tree ${nocheck})
 [ "$treeid" ] || die "git-write-tree failed"
 if [ ! "$force" ] && [ ! "$merging" ] && [ "$oldhead" ] &&
    [ "$treeid" = "$(tree-id)" ]; then




```

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

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

```
(resending cogito patches)

add the -N option to cg-init

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

 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 -m"Initial commit" -E
 fi
 

```

## Petr Baudis, 2005-07-10 15:17

Subject: Re: [PATCH 1/3] add -N option to cg-add (resent)
Message-ID: <20050710151718.GD24249@pasky.ji.cz>
URL: https://gitlist.dev/e/20050710151718.GD24249%40pasky.ji.cz
In-Reply-To: <20050709104331.26765.35929.sendpatchset@bryan-larsens-ibook-g4.local>

```
Dear diary, on Sat, Jul 09, 2005 at 12:40:22PM CEST, I got a letter
where Bryan Larsen <bryanlarsen@yahoo.com> told me that...
> (resending cogito patches)
> 
> Add the -N option to cg-add.
> 
> Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>

Applied all three patches. Note that I'm a bit happier when they are a
little more maintainer-friendly - it helps to describe why are you
resending them, and be a little more verbose in the accompanying
message. :-)

Thanks,

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
<Espy> be careful, some twit might quote you out of context..

```
