update cg-* to use cg-Xignore
PATCH 2/2 update cg-* to use cg-Xignore
Updated
cg-add
cg-commit
cg-init
cg-status
to use the cg-Xignore
---
commit 80e8dbdd3cf5e8d4ca0b6e446911d1ac17c5064e
tree 03662df7d089d4a84987ef9edb50a017b8b42439
parent 2fca920e6d3ccb92e9782bcf02f860b8333e23d9
author David Greaves <[email protected]> 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(-)
cg-add (mode:100755) +5 -8
@@ -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 --
cg-commit (mode:100755) +9 -0
@@ -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)
cg-init (mode:100755) +6 -1
@@ -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
cg-status (mode:100755) +2 -12
@@ -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%: *};
Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 3 lines
Updated
cg-add
cg-commit
I consider this Bad Thing (tm). Or could you please point a situation where this would be actually useful? If you explicitly cg-add, you likely know what are you doing, and same thing with cg-commit - if it's already added, it should be watches, no matter what ignore patterns, I think.
Quoted 8 lines
cg-commit (mode:100755) +2
-0@@ -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
cg-commit (mode:100755) line 79
Quoted 10 lines
cg-commit (mode:100755) +7
-0+# 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)
The variable? What variable?
Quoted 10 lines
Index: cg-status
===================================================================cg-status (mode:100755) +0
-2@@ -15,21 +15,11 @@ { git-ls-files -z -t --others --deleted --unmerged $EXCLUDE -} | sort -z -k 2 | xargs -0 sh -c ' -while [ "$1" ]; do
cg-status (mode:100755) line 18
Quoted 10 lines
cg-status (mode:100755) +1
-9- 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"
So you have two ignores now - exclude and Xignore.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Quoted 10 lines · Petr Baudis
Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 5 lines
Updated
cg-add
cg-commit
Quoted 7 lines
I consider this Bad Thing (tm). Or could you please point a situation where this would be actually useful? If you explicitly cg-add, you likely know what are you doing, and same thing with cg-commit - if it's already added, it should be watches, no matter what ignore patterns, I think.
OK, lets say I'm clever and know what an ignore pattern is. I can
find * | xargs cg-add
my laziness something my hubris acknowledges :)
And in fact this has come up a few times on the list already - it was that code snippet in cg-init that caused me to create cg-Xignore because as someone pointed out, even finding files/links would still cause probs with files beginning with '.'
does that sway you?
Quoted 16 lines
Quoted 16 lines
cg-commit (mode:100755) +0
-0@@ -65,6 +65,15 @@ [ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')fi
cg-commit (mode:100755) +9
-0+# 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
Quoted 8 lines
Quoted 4 lines
LOGMSG=$(mktemp -t gitci.XXXXXX)
LOGMSG2=$(mktemp -t gitci.XXXXXX)The variable? What variable?
well basically we want to edit the commitfiles variable - perl map() a more efficient method in shell appears to be:
foreach file in commitfiles; echo file | filter | read into commitfiles I spent ages trying not to exec a cg-Ignore process per file comparison
Quoted 16 lines
Quoted 16 lines
Index: cg-status
===================================================================cg-status (mode:100755) +0
-8@@ -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
Quoted 10 lines
cg-status (mode:100755)
Quoted 6 lines
cg-status (mode:100755) +1
-3- shift -done -' padding +} | sort -z -k 2 | cg-Xignore -0 -t | tr "\000" "\n"So you have two ignores now - exclude and Xignore.
No, cogito has an ignore.
git has a less powerful exclude.
cogito users won't need exclude but power-users aren't barred from it.
David
Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 19 lines
Quoted 10 lines · Petr Baudis
Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 5 lines
Updated
cg-add
cg-commitQuoted 7 lines
I consider this Bad Thing (tm). Or could you please point a situation where this would be actually useful? If you explicitly cg-add, you likely know what are you doing, and same thing with cg-commit - if it's already added, it should be watches, no matter what ignore patterns, I think.
Quoted 4 lines
OK, lets say I'm clever and know what an ignore pattern is. I can
find * | xargs cg-add
my laziness something my hubris acknowledges :)
Makes sense, ok.
What about cg-commit? You already even added it.
Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
Index: cg-status
===================================================================cg-status (mode:100755) +0
-8@@ -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";; - esacQuoted 10 lines
cg-status (mode:100755)
Quoted 6 lines
cg-status (mode:100755) +1
-3- shift -done -' padding +} | sort -z -k 2 | cg-Xignore -0 -t | tr "\000" "\n"So you have two ignores now - exclude and Xignore.
Quoted 3 lines
No, cogito has an ignore.
git has a less powerful exclude.
cogito users won't need exclude but power-users aren't barred from it.
I think having two essentially redundant things is useless. But you'll be able to use the --exclude powers now since you have to fall back to good ol' globs.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Quoted 4 lines · Petr Baudis
Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 8 lines
Quoted 3 lines
Petr Baudis wrote:
Makes sense, ok.
What about cg-commit? You already even added it.
I'd use the same argument - you want to commit files changed in a directory:
find src | xargs cg-commit
find Documentation | xargs cg-commit
I agree it's less compelling.
I admit I was primarily just making sure that all cg-* commands behaved the same way.
I also don't have an ignore-override - do you think we need one?
Quoted 11 lines
Quoted 5 lines
No, cogito has an ignore.
git has a less powerful exclude.
cogito users won't need exclude but power-users aren't barred from it.I think having two essentially redundant things is useless. But you'll be able to use the --exclude powers now since you have to fall back to good ol' globs.
unless...
Dear diary, on Sat, May 14, 2005 at 04:44:00PM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 15 lines
Quoted 4 lines · Petr Baudis
Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter where David Greaves <[email protected]> told me that...
Quoted 8 lines
Quoted 3 lines
Petr Baudis wrote:
Makes sense, ok.
What about cg-commit? You already even added it.
Quoted 6 lines
I'd use the same argument - you want to commit files changed in a directory:
find src | xargs cg-commit
find Documentation | xargs cg-commit
I agree it's less compelling.
I admit I was primarily just making sure that all cg-* commands behaved the same way.
Thinking about it, I think we can actually live with it. I agree that it's more consistent.
Quoted 1 line
I also don't have an ignore-override - do you think we need one?
I'd prefer CVS-like format. That is, lines starting with ! are exceptions to previous ignore rules.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
No, cogito has an ignore.
git has a less powerful exclude.
cogito users won't need exclude but power-users aren't barred from it.
Quoted 6 lines
Quoted 5 lines
I think having two essentially redundant things is useless. But you'll be able to use the --exclude powers now since you have to fall back to good ol' globs.
unless...
See my other mail that I'd prefer globs as the main ignoring mechanism anyway. ;-)
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor