git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] update cg-* to use cg-Xignore

From
David Greaves <david@dgreaves.com>
Date
May 13, 2005, 22:32 UTC
Message-ID
<E1DWihi-0007DQ-SD@ash.dgreaves.com>
Updated
    cg-add
    cg-commit
    cg-init
    cg-status
to use the cg-Xignore
Signed-off-by: David Greaves <david@dgreaves.com>

--- commit 80e8dbdd3cf5e8d4ca0b6e446911d1ac17c5064e tree 03662df7d089d4a84987ef9edb50a017b8b42439 parent 2fca920e6d3ccb92e9782bcf02f860b8333e23d9 author David Greaves <david@dgreaves.com> Fri, 13 May 2005 23:18:20 +0100 committer David Greaves <david@ash.(none)> Fri, 13 May 2005 23:18:20 +0100

 cg-add    |   13 +++++--------
 cg-commit |    9 +++++++++
 cg-init   |    7 ++++++-
 cg-status |   14 ++------------
 4 files changed, 22 insertions(+), 21 deletions(-)
Index: cg-add
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-add  (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-add  (mode:100755)
@@ -11,11 +11,8 @@
 [ "$1" ] || die "usage: cg-add FILE..."
 
 for file in "$@"; do
-	if [ -f "$file" ] || [ -h "$file" ]; then
-		echo "Adding file $file"
-	else
-		die "$file does not exist"
-	fi
-done
-
-git-update-cache --add -- "$@"
+    if [ -f "$file" ] || [ -h "$file" ]; then
+	echo "Adding file $file" >&2
+    fi
+    echo "$file"
+done | cg-Xignore -f -h | xargs git-update-cache --add --
Index: cg-commit
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit  (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit  (mode:100755)
@@ -65,6 +65,15 @@
 	[ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')
 fi
 
+# strip ignored files - *1 at a time* - any attempt to stream from 1
+# while loop to another uses a subprocess and can't pass the variable
+# back
+# Also I don't know if this can be put in a shell function
+for file in ${commitfiles[@]}
+  do
+  commitfiles[$i]=`echo $file | cg-Xignore`
+  ((i++))
+done
 
 LOGMSG=$(mktemp -t gitci.XXXXXX)
 LOGMSG2=$(mktemp -t gitci.XXXXXX)
Index: cg-init
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-init  (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-init  (mode:100755)
@@ -7,6 +7,9 @@
 # remote repository. Note that this usage is DEPRECATED - use cg-clone
 # (possibly with the -s parameter) for doing this. This functionality
 # will go away from cg-init soon.
+#
+# if there is a file called cogito.ignore then it is used to prime the
+# .git/ignore patterns
 
 . ${COGITO_LIB}cg-Xlib
 
@@ -19,6 +22,8 @@
 touch $_git/refs/heads/master
 ln -s refs/heads/master $_git/HEAD
 
+[ -f cogito.ignore ] && mv cogito.ignore .git/ignore
+
 if [ "$uri" ]; then
 	echo "$uri" >$_git/branches/origin
 	cg-pull origin || die "pull failed"
@@ -31,7 +36,7 @@
 	echo "Cloned (origin $uri available as branch \"origin\")"
 else
 	git-read-tree # Seed the dircache
-	find * -type f | xargs cg-add
+	find * | cg-Xignore -f -h | xargs cg-add
 	cg-commit -C -m"Initial commit" -e
 fi
 exit 0
Index: cg-status
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status  (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status  (mode:100755)
@@ -15,21 +15,11 @@
 
 {
 	git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
-} | sort -z -k 2 | xargs -0 sh -c '
-while [ "$1" ]; do
-	tag=${1% *};
-	filename=${1#* };
-	case "$filename" in
-	*.[ao] | tags | ,,merge*) ;;
-	*)   echo "$tag $filename";;
-	esac
-	shift
-done
-' padding
+} | sort -z -k 2 | cg-Xignore -0 -t | tr "\000" "\n"
 
 {
 	git-update-cache --refresh
-} | cut -f 1 -d ":" | xargs sh -c '
+} | cut -f 1 -d ":" | cg-Xignore | xargs sh -c '
 while [ "$1" ]; do
 	tag="M";
 	filename=${1%: *};
Next: Petr Baudis
Message 1 of 6 in “update cg-* to use cg-Xignore”
  1. 2/2 update cg-* to use cg-XignoreDavid Greaves, May 13, 2005
  2. Petr BaudisMay 13, 2005
  3. David GreavesMay 14, 2005
  4. Petr BaudisMay 14, 2005
  5. David GreavesMay 14, 2005
  6. Petr BaudisMay 14, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.