git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH Cogito] cg-init breaks if . contains sub-dir
@ 2005-05-09 23:39 Brandon Philips
  2005-05-10  1:36 ` Morten Welinder
  2005-05-10  3:41 ` Matthias Urlichs
  0 siblings, 2 replies; 22+ messages in thread
From: Brandon Philips @ 2005-05-09 23:39 UTC (permalink / raw
  To: Petr Baudis; +Cc: GIT Mailing List

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

Hi Petr,

cg-init has the ability to cg-add all files in the current directory.

But if the current directory has a sub directory cg-init breaks because
the `find *` command on line 34 returns directories which cg-add doesn't
accept.

Regards

Brandon Philips

Shameless plug: cogito-0.10 available in Gentoo

--
http://ifup.org

---

cg-init: needs update
Index: cg-init
===================================================================
--- 972d8624458936868e6f392b40858b7c362af8cd/cg-init  (mode:100755)
+++ uncommitted/cg-init  (mode:100755)
@@ -31,7 +31,7 @@
 	echo "Cloned (origin $uri available as branch \"origin\")"
 else
 	git-read-tree # Seed the dircache
-	find * | xargs cg-add
+	find * ! -type d | xargs cg-add 
 	cg-commit -C -m"Initial commit" -e
 fi
 exit 0

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-09 23:39 [PATCH Cogito] cg-init breaks if . contains sub-dir Brandon Philips
@ 2005-05-10  1:36 ` Morten Welinder
  2005-05-10  3:41 ` Matthias Urlichs
  1 sibling, 0 replies; 22+ messages in thread
From: Morten Welinder @ 2005-05-10  1:36 UTC (permalink / raw
  To: Brandon Philips; +Cc: Petr Baudis, GIT Mailing List

And it is also unhappy when the directory is empty or contains dotfiles only.

Morten

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-09 23:39 [PATCH Cogito] cg-init breaks if . contains sub-dir Brandon Philips
  2005-05-10  1:36 ` Morten Welinder
@ 2005-05-10  3:41 ` Matthias Urlichs
  2005-05-10  5:17   ` Brian Gerst
  1 sibling, 1 reply; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-10  3:41 UTC (permalink / raw
  To: git

Hi, Brandon Philips wrote:

> -	find * | xargs cg-add
> +	find * ! -type d | xargs cg-add

Actually, (almost) every use of "find | xargs" which is not a subset of
"find -print0 | xargs -0r" is a bug.

So please don't do that. Special files aren't liked by git either, thus:

        find * -type f -print0 | xargs -0r cg-add

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de



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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  3:41 ` Matthias Urlichs
@ 2005-05-10  5:17   ` Brian Gerst
  2005-05-10  7:52     ` Jan-Benedict Glaw
  0 siblings, 1 reply; 22+ messages in thread
From: Brian Gerst @ 2005-05-10  5:17 UTC (permalink / raw
  To: Matthias Urlichs; +Cc: git

Matthias Urlichs wrote:
> Hi, Brandon Philips wrote:
> 
> 
>>-	find * | xargs cg-add
>>+	find * ! -type d | xargs cg-add
> 
> 
> Actually, (almost) every use of "find | xargs" which is not a subset of
> "find -print0 | xargs -0r" is a bug.
> 
> So please don't do that. Special files aren't liked by git either, thus:
> 
>         find * -type f -print0 | xargs -0r cg-add
> 

But it can handle symlinks:

	find * -type f -o -type l -print0 | xargs -0r cg-add

--
				Brian Gerst

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  5:17   ` Brian Gerst
@ 2005-05-10  7:52     ` Jan-Benedict Glaw
  2005-05-10  8:04       ` Jan-Benedict Glaw
  2005-05-12 18:53       ` Petr Baudis
  0 siblings, 2 replies; 22+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-10  7:52 UTC (permalink / raw
  To: Brian Gerst; +Cc: Matthias Urlichs, git

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

On Tue, 2005-05-10 01:17:31 -0400, Brian Gerst <bgerst@didntduck.org> wrote:
> But it can handle symlinks:
> 
> 	find * -type f -o -type l -print0 | xargs -0r cg-add

This won't work because the explicit OR (-o) lower precedence compared
to the implicit AND between "-type l" and "-print0", thus this find
command will do print0 IFF the matched entry is a symlink. Use something
like this instead:

	find * \( -type f -o tyle l \) -print0 | ...

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  7:52     ` Jan-Benedict Glaw
@ 2005-05-10  8:04       ` Jan-Benedict Glaw
  2005-05-10  8:36         ` Matthias Urlichs
                           ` (2 more replies)
  2005-05-12 18:53       ` Petr Baudis
  1 sibling, 3 replies; 22+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-10  8:04 UTC (permalink / raw
  To: Brian Gerst; +Cc: Matthias Urlichs, git

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Tue, 2005-05-10 09:52:27 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> On Tue, 2005-05-10 01:17:31 -0400, Brian Gerst <bgerst@didntduck.org> wrote:
> > But it can handle symlinks:
> > 
> > 	find * -type f -o -type l -print0 | xargs -0r cg-add
> 
> This won't work because the explicit OR (-o) lower precedence compared
> to the implicit AND between "-type l" and "-print0", thus this find
> command will do print0 IFF the matched entry is a symlink. Use something
> like this instead:
> 
> 	find * \( -type f -o tyle l \) -print0 | ...

Btw, this won't find dot files, so using "." as the path list (instead
of "*") might be wise...

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:04       ` Jan-Benedict Glaw
@ 2005-05-10  8:36         ` Matthias Urlichs
  2005-05-10  8:56           ` Martin Waitz
  2005-05-10  8:56           ` Jan-Benedict Glaw
  2005-05-10  8:42         ` David Greaves
  2005-05-10  9:01         ` Junio C Hamano
  2 siblings, 2 replies; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-10  8:36 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Brian Gerst, git

Hi,

Jan-Benedict Glaw:
> > 	find * \( -type f -o tyle l \) -print0 | ...
> 
> Btw, this won't find dot files, so using "." as the path list (instead
> of "*") might be wise...
> 
git doesn't want to handle dot files anyway.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:04       ` Jan-Benedict Glaw
  2005-05-10  8:36         ` Matthias Urlichs
@ 2005-05-10  8:42         ` David Greaves
  2005-05-10  9:01         ` Junio C Hamano
  2 siblings, 0 replies; 22+ messages in thread
From: David Greaves @ 2005-05-10  8:42 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Brian Gerst, Matthias Urlichs, git

Jan-Benedict Glaw wrote:

>On Tue, 2005-05-10 09:52:27 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
>  
>
>>On Tue, 2005-05-10 01:17:31 -0400, Brian Gerst <bgerst@didntduck.org> wrote:
>>    
>>
>>>But it can handle symlinks:
>>>
>>>	find * -type f -o -type l -print0 | xargs -0r cg-add
>>>      
>>>
>>This won't work because the explicit OR (-o) lower precedence compared
>>to the implicit AND between "-type l" and "-print0", thus this find
>>command will do print0 IFF the matched entry is a symlink. Use something
>>like this instead:
>>
>>	find * \( -type f -o tyle l \) -print0 | ...
>>    
>>
>
>Btw, this won't find dot files, so using "." as the path list (instead
>of "*") might be wise...
>  
>
This is a good thing - git ignores dot-files. see:
  http://www.dgreaves.com/git/git-update-cache.html
*
<file> *
    Files to act on. Note that files begining with *.* are discarded.
    This includes ./file and dir/./file. If you don't want this, then
    use cleaner names. The same applies to directories ending */* and
    paths with *//* 

Cogito should eventually spot and remove these since find * will
obviously find files beginning with a dot in subdirectories.

David

-- 


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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:36         ` Matthias Urlichs
@ 2005-05-10  8:56           ` Martin Waitz
  2005-05-10  8:56           ` Jan-Benedict Glaw
  1 sibling, 0 replies; 22+ messages in thread
From: Martin Waitz @ 2005-05-10  8:56 UTC (permalink / raw
  To: Matthias Urlichs; +Cc: Jan-Benedict Glaw, Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

hoi :)

On Tue, May 10, 2005 at 10:36:09AM +0200, Matthias Urlichs wrote:
> Jan-Benedict Glaw:
> > > 	find * \( -type f -o tyle l \) -print0 | ...
> > 
> > Btw, this won't find dot files, so using "." as the path list (instead
> > of "*") might be wise...
> > 
> git doesn't want to handle dot files anyway.

but find will output dotfiles in subdirectories.
So you have to prune the list anyway.

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:36         ` Matthias Urlichs
  2005-05-10  8:56           ` Martin Waitz
@ 2005-05-10  8:56           ` Jan-Benedict Glaw
  2005-05-10  9:47             ` David Greaves
  1 sibling, 1 reply; 22+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-10  8:56 UTC (permalink / raw
  To: Matthias Urlichs; +Cc: Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

On Tue, 2005-05-10 10:36:09 +0200, Matthias Urlichs <smurf@smurf.noris.de> wrote:
> Jan-Benedict Glaw:
> > > 	find * \( -type f -o tyle l \) -print0 | ...
> > 
> > Btw, this won't find dot files, so using "." as the path list (instead
> > of "*") might be wise...
> > 
> git doesn't want to handle dot files anyway.

...which I actually consider to be a bug. Why should git care about the
filename, as long as it doesn't clash with ".git"?  After all, it's just
a plumbing mechanism designed to locate file contents by SHA-1 hashes.
It shouldn't deal with file names at all, really:-)

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:04       ` Jan-Benedict Glaw
  2005-05-10  8:36         ` Matthias Urlichs
  2005-05-10  8:42         ` David Greaves
@ 2005-05-10  9:01         ` Junio C Hamano
  2005-05-10  9:32           ` Jan-Benedict Glaw
  2 siblings, 1 reply; 22+ messages in thread
From: Junio C Hamano @ 2005-05-10  9:01 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Brian Gerst, Matthias Urlichs, git

>>>>> "JBG" == Jan-Benedict Glaw <jbglaw@lug-owl.de> writes:

>> find * \( -type f -o tyle l \) -print0 | ...

JBG> Btw, this won't find dot files, so using "." as the path list (instead
JBG> of "*") might be wise...

Huh?  Since when GIT started managing paths whose _any_ of their
path component starts with a dot?


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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:01         ` Junio C Hamano
@ 2005-05-10  9:32           ` Jan-Benedict Glaw
  2005-05-10  9:39             ` Matthias Urlichs
  0 siblings, 1 reply; 22+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-10  9:32 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Brian Gerst, Matthias Urlichs, git

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

On Tue, 2005-05-10 02:01:41 -0700, Junio C Hamano <junkio@cox.net> wrote:
> >>>>> "JBG" == Jan-Benedict Glaw <jbglaw@lug-owl.de> writes:
> 
> >> find * \( -type f -o tyle l \) -print0 | ...
> 
> JBG> Btw, this won't find dot files, so using "." as the path list (instead
> JBG> of "*") might be wise...
> 
> Huh?  Since when GIT started managing paths whose _any_ of their
> path component starts with a dot?

The Catholic Church never ever had female priests, so how could this
be a good thing?

Ever thought about keeping some important files (of your $HOME) in some
SCM? For sure, some of those are dot files:-)

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:32           ` Jan-Benedict Glaw
@ 2005-05-10  9:39             ` Matthias Urlichs
  2005-05-10  9:45               ` Jan-Benedict Glaw
  0 siblings, 1 reply; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-10  9:39 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Junio C Hamano, Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Hi,

Jan-Benedict Glaw:
> Ever thought about keeping some important files (of your $HOME) in some
> SCM? For sure, some of those are dot files:-)
> 
Yeah, but so are various local temporary files.

Please don't change that without talking to Linus.


FWIW, I keep important files backed up (backuppc is your friend).
No need to bother with an SCM for that.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:39             ` Matthias Urlichs
@ 2005-05-10  9:45               ` Jan-Benedict Glaw
  2005-05-10  9:58                 ` Matthias Urlichs
  2005-05-10 15:14                 ` [PATCH Cogito] cg-init breaks if . contains sub-dir H. Peter Anvin
  0 siblings, 2 replies; 22+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-10  9:45 UTC (permalink / raw
  To: Matthias Urlichs; +Cc: Junio C Hamano, Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 925 bytes --]

On Tue, 2005-05-10 11:39:24 +0200, Matthias Urlichs <smurf@smurf.noris.de> wrote:
> Jan-Benedict Glaw:
> > Ever thought about keeping some important files (of your $HOME) in some
> > SCM? For sure, some of those are dot files:-)
>
> Yeah, but so are various local temporary files.
> 
> Please don't change that without talking to Linus.

I won't.  You haven't seen a patch from me "fixing" this, too.  *I*
consider this as a defect, but that doesn't mean that I'll force others
to take this view, too.  But maybe I'll talk Linus into this when he's
back from his trip.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  8:56           ` Jan-Benedict Glaw
@ 2005-05-10  9:47             ` David Greaves
  0 siblings, 0 replies; 22+ messages in thread
From: David Greaves @ 2005-05-10  9:47 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Matthias Urlichs, Brian Gerst, git

Jan-Benedict Glaw wrote:

>On Tue, 2005-05-10 10:36:09 +0200, Matthias Urlichs <smurf@smurf.noris.de> wrote:
>  
>
>>Jan-Benedict Glaw:
>>    
>>
>>>>	find * \( -type f -o tyle l \) -print0 | ...
>>>>        
>>>>
>>>Btw, this won't find dot files, so using "." as the path list (instead
>>>of "*") might be wise...
>>>
>>>      
>>>
>>git doesn't want to handle dot files anyway.
>>    
>>
>
>...which I actually consider to be a bug. Why should git care about the
>filename, as long as it doesn't clash with ".git"?  After all, it's just
>a plumbing mechanism designed to locate file contents by SHA-1 hashes.
>It shouldn't deal with file names at all, really:-)
>  
>
I tend to agree that a generic 'content tracking system' shouldn't
impose this kind of rule.
Requiring well formed filenames (eg no //, no trailing /s) is fine - but
dot-file-discrimination?

When I first saw it, I expected this kind of rule to (eventually) be
lifted from the plumbing to the porcelain. The minor problem is that
Linus seems to like getting his hands dirty and keeps using the plumbing ;)
(eek - these analogies...)

David

-- 


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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:45               ` Jan-Benedict Glaw
@ 2005-05-10  9:58                 ` Matthias Urlichs
  2005-05-10 21:31                   ` David Mansfield
  2005-05-10 15:14                 ` [PATCH Cogito] cg-init breaks if . contains sub-dir H. Peter Anvin
  1 sibling, 1 reply; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-10  9:58 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Junio C Hamano, Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Hi,

Jan-Benedict Glaw:
> > Please don't change that without talking to Linus.
> 
> I won't.  You haven't seen a patch from me "fixing" this, too.  *I*
> consider this as a defect, but that doesn't mean that I'll force others
> to take this view, too.  But maybe I'll talk Linus into this when he's
> back from his trip.

That would be a good idea; I do support dropping (or at least relaxing)
that rule. For excluding unwanted files, I'd suggest using a .git/ignore
file with nice shiny patterns (*.a *.o *.swp ...) inside -- git already
supports that anyway.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:45               ` Jan-Benedict Glaw
  2005-05-10  9:58                 ` Matthias Urlichs
@ 2005-05-10 15:14                 ` H. Peter Anvin
  1 sibling, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2005-05-10 15:14 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Matthias Urlichs, Junio C Hamano, Brian Gerst, git

Jan-Benedict Glaw wrote:
> On Tue, 2005-05-10 11:39:24 +0200, Matthias Urlichs <smurf@smurf.noris.de> wrote:
> 
>>Jan-Benedict Glaw:
>>
>>>Ever thought about keeping some important files (of your $HOME) in some
>>>SCM? For sure, some of those are dot files:-)
>>
>>Yeah, but so are various local temporary files.
>>
>>Please don't change that without talking to Linus.
> 
> 
> I won't.  You haven't seen a patch from me "fixing" this, too.  *I*
> consider this as a defect, but that doesn't mean that I'll force others
> to take this view, too.  But maybe I'll talk Linus into this when he's
> back from his trip.
> 

Another vote for fixing this!

	-hpa

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  9:58                 ` Matthias Urlichs
@ 2005-05-10 21:31                   ` David Mansfield
  2005-05-11  5:25                     ` [PATCH Cogito] match pathnames in exclude handling Matthias Urlichs
  0 siblings, 1 reply; 22+ messages in thread
From: David Mansfield @ 2005-05-10 21:31 UTC (permalink / raw
  To: Matthias Urlichs; +Cc: Jan-Benedict Glaw, Junio C Hamano, Brian Gerst, git

Matthias Urlichs wrote:
> Hi,
> 
> Jan-Benedict Glaw:
> 
>>>Please don't change that without talking to Linus.
>>
>>I won't.  You haven't seen a patch from me "fixing" this, too.  *I*
>>consider this as a defect, but that doesn't mean that I'll force others
>>to take this view, too.  But maybe I'll talk Linus into this when he's
>>back from his trip.
> 
> 
> That would be a good idea; I do support dropping (or at least relaxing)
> that rule. For excluding unwanted files, I'd suggest using a .git/ignore
> file with nice shiny patterns (*.a *.o *.swp ...) inside -- git already
> supports that anyway.
> 

Speaking of which, for a large project, (such as the kernel) it is a 
pain in the butt if exclude lists only consider the 'basename' of the 
file, and cannot include any path matching information.

For a long time there were generated files in the kernel which had the 
same names as non-generated files somewhere else in the kernel tree 
(under a different path).  Making an automated 'take latest patch from 
Linus, apply, commit' was really a pain because of this.

Is there/will there be support for path matching in the ignore files?

If the answer is no, but people like the idea, I could look into it.

David





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

* [PATCH Cogito] match pathnames in exclude handling
  2005-05-10 21:31                   ` David Mansfield
@ 2005-05-11  5:25                     ` Matthias Urlichs
  2005-05-11 21:30                       ` H. Peter Anvin
  0 siblings, 1 reply; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-11  5:25 UTC (permalink / raw
  To: David Mansfield; +Cc: Jan-Benedict Glaw, Junio C Hamano, Brian Gerst, git

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

Hi,

David Mansfield:
> Is there/will there be support for path matching in the ignore files?
> 
> If the answer is no, but people like the idea, I could look into it.
> 
I already did, last week. (I do need to cleanup my changes...)

The idea is that "foo" matches anywhere, "foo/bar" the exact pathname.
As a special case, "./foo" matches in the root directory only.

NB: "*" can cross subdirectory paths, so "*/foo/bar" does match
"a/b/c/foo/bar".

Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>

---
Index: ls-files.c
===================================================================
--- 972d8624458936868e6f392b40858b7c362af8cd/ls-files.c  (mode:100644)
+++ 12deb13b12cdb338fe3fdc2e77a024490d6c39ea/ls-files.c  (mode:100644)
@@ -80,9 +80,17 @@
 	if (nr_excludes) {
 		const char *basename = strrchr(pathname, '/');
 		basename = (basename) ? basename+1 : pathname;
-		for (i = 0; i < nr_excludes; i++)
-			if (fnmatch(excludes[i], basename, 0) == 0)
-				return 1;
+		for (i = 0; i < nr_excludes; i++) {
+			if (excludes[i][0] != '.' || excludes[i][1] != '/') {
+				if (fnmatch(excludes[i], pathname, 0) == 0)
+					return 1;
+				if (basename != pathname && fnmatch(excludes[i], pathname, 0) == 0)
+					return 1;
+			} else {
+				if (fnmatch(excludes[i]+2, pathname, 0) == 0)
+					return 1;
+			}
+		}
 	}
 	return 0;
 }
@@ -129,10 +137,10 @@
 
 			if (de->d_name[0] == '.')
 				continue;
-			if (excluded(de->d_name) != show_ignored)
-				continue;
 			len = strlen(de->d_name);
 			memcpy(fullname + baselen, de->d_name, len+1);
+			if (excluded(fullname) != show_ignored)
+				continue;
 
 			switch (DTYPE(de)) {
 			struct stat st;
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] match pathnames in exclude handling
  2005-05-11  5:25                     ` [PATCH Cogito] match pathnames in exclude handling Matthias Urlichs
@ 2005-05-11 21:30                       ` H. Peter Anvin
  2005-05-12  7:54                         ` Matthias Urlichs
  0 siblings, 1 reply; 22+ messages in thread
From: H. Peter Anvin @ 2005-05-11 21:30 UTC (permalink / raw
  To: Matthias Urlichs
  Cc: David Mansfield, Jan-Benedict Glaw, Junio C Hamano, Brian Gerst,
	git

Matthias Urlichs wrote:
> 
> I already did, last week. (I do need to cleanup my changes...)
> 
> The idea is that "foo" matches anywhere, "foo/bar" the exact pathname.
> As a special case, "./foo" matches in the root directory only.
> 
> NB: "*" can cross subdirectory paths, so "*/foo/bar" does match
> "a/b/c/foo/bar".
> 

How does that mean foo*.c would match foo/bar/quux.c?  That's probably a 
bad thing.

I do like the (sadly, rarely used) convention that ** matches / whereas 
* doesn't.

	-hpa

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

* Re: [PATCH Cogito] match pathnames in exclude handling
  2005-05-11 21:30                       ` H. Peter Anvin
@ 2005-05-12  7:54                         ` Matthias Urlichs
  0 siblings, 0 replies; 22+ messages in thread
From: Matthias Urlichs @ 2005-05-12  7:54 UTC (permalink / raw
  To: H. Peter Anvin
  Cc: David Mansfield, Jan-Benedict Glaw, Junio C Hamano, Brian Gerst,
	git

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Hi,

H. Peter Anvin:
> How does that mean foo*.c would match foo/bar/quux.c?  That's probably a 
> bad thing.
> 
No, of course not -- that was a thinko on my part when I typed the
examples.  :-/

> I do like the (sadly, rarely used) convention that ** matches / whereas 
> * doesn't.
> 
fnmatch() doesn't support that. Of course, if there's demand for it,
it should be reasonably easy to have our own extended copy.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH Cogito] cg-init breaks if . contains sub-dir
  2005-05-10  7:52     ` Jan-Benedict Glaw
  2005-05-10  8:04       ` Jan-Benedict Glaw
@ 2005-05-12 18:53       ` Petr Baudis
  1 sibling, 0 replies; 22+ messages in thread
From: Petr Baudis @ 2005-05-12 18:53 UTC (permalink / raw
  To: Jan-Benedict Glaw; +Cc: Brian Gerst, Matthias Urlichs, git

Dear diary, on Tue, May 10, 2005 at 09:52:27AM CEST, I got a letter
where Jan-Benedict Glaw <jbglaw@lug-owl.de> told me that...
> On Tue, 2005-05-10 01:17:31 -0400, Brian Gerst <bgerst@didntduck.org> wrote:
> > But it can handle symlinks:
> > 
> > 	find * -type f -o -type l -print0 | xargs -0r cg-add
> 
> This won't work because the explicit OR (-o) lower precedence compared
> to the implicit AND between "-type l" and "-print0", thus this find
> command will do print0 IFF the matched entry is a symlink. Use something
> like this instead:
> 
> 	find * \( -type f -o tyle l \) -print0 | ...

Thanks to all the four co-authors, applied.

-- 
				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] 22+ messages in thread

end of thread, other threads:[~2005-05-12 18:46 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-09 23:39 [PATCH Cogito] cg-init breaks if . contains sub-dir Brandon Philips
2005-05-10  1:36 ` Morten Welinder
2005-05-10  3:41 ` Matthias Urlichs
2005-05-10  5:17   ` Brian Gerst
2005-05-10  7:52     ` Jan-Benedict Glaw
2005-05-10  8:04       ` Jan-Benedict Glaw
2005-05-10  8:36         ` Matthias Urlichs
2005-05-10  8:56           ` Martin Waitz
2005-05-10  8:56           ` Jan-Benedict Glaw
2005-05-10  9:47             ` David Greaves
2005-05-10  8:42         ` David Greaves
2005-05-10  9:01         ` Junio C Hamano
2005-05-10  9:32           ` Jan-Benedict Glaw
2005-05-10  9:39             ` Matthias Urlichs
2005-05-10  9:45               ` Jan-Benedict Glaw
2005-05-10  9:58                 ` Matthias Urlichs
2005-05-10 21:31                   ` David Mansfield
2005-05-11  5:25                     ` [PATCH Cogito] match pathnames in exclude handling Matthias Urlichs
2005-05-11 21:30                       ` H. Peter Anvin
2005-05-12  7:54                         ` Matthias Urlichs
2005-05-10 15:14                 ` [PATCH Cogito] cg-init breaks if . contains sub-dir H. Peter Anvin
2005-05-12 18:53       ` Petr Baudis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).