git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] update cg-* to use cg-Xignore
@ 2005-05-13 22:32 David Greaves
  2005-05-13 22:55 ` Petr Baudis
  0 siblings, 1 reply; 6+ messages in thread
From: David Greaves @ 2005-05-13 22:32 UTC (permalink / raw)
  To: Petr Baudis; +Cc: GIT Mailing Lists

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%: *};

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-14 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 22:32 [PATCH 2/2] update cg-* to use cg-Xignore David Greaves
2005-05-13 22:55 ` Petr Baudis
2005-05-14  8:24   ` David Greaves
2005-05-14 12:18     ` Petr Baudis
2005-05-14 14:44       ` David Greaves
2005-05-14 15:14         ` Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).