* [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
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
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
0 siblings, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2005-05-13 22:55 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> 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.
> --- 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)
The variable? What variable?
> 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"
So you have two ignores now - exclude and Xignore.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
2005-05-13 22:55 ` Petr Baudis
@ 2005-05-14 8:24 ` David Greaves
2005-05-14 12:18 ` Petr Baudis
0 siblings, 1 reply; 6+ messages in thread
From: David Greaves @ 2005-05-14 8:24 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing Lists
Petr Baudis wrote:
>Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter
>where David Greaves <david@dgreaves.com> told me that...
>
>
>>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.
>
>
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?
>>--- 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)
>>
>>
>
>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
>>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"
>>
>>
>
>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
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
2005-05-14 8:24 ` David Greaves
@ 2005-05-14 12:18 ` Petr Baudis
2005-05-14 14:44 ` David Greaves
0 siblings, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2005-05-14 12:18 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> Petr Baudis wrote:
>
> >Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter
> >where David Greaves <david@dgreaves.com> told me that...
> >
> >
> >>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.
> >
> >
> 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.
> >>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"
> >>
> >>
> >
> >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.
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.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
2005-05-14 12:18 ` Petr Baudis
@ 2005-05-14 14:44 ` David Greaves
2005-05-14 15:14 ` Petr Baudis
0 siblings, 1 reply; 6+ messages in thread
From: David Greaves @ 2005-05-14 14:44 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing Lists
Petr Baudis wrote:
>Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter
>where David Greaves <david@dgreaves.com> told me that...
>
>
>>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?
>>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...
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
2005-05-14 14:44 ` David Greaves
@ 2005-05-14 15:14 ` Petr Baudis
0 siblings, 0 replies; 6+ messages in thread
From: Petr Baudis @ 2005-05-14 15:14 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
Dear diary, on Sat, May 14, 2005 at 04:44:00PM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> Petr Baudis wrote:
>
> >Dear diary, on Sat, May 14, 2005 at 10:24:42AM CEST, I got a letter
> >where David Greaves <david@dgreaves.com> told me that...
> >
> >
> >>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.
Thinking about it, I think we can actually live with it. I agree that
it's more consistent.
> 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.
> >>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...
See my other mail that I'd prefer globs as the main ignoring mechanism
anyway. ;-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ 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).