git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitattributes don't work
@ 2011-01-03  0:42 Marcin Wiśnicki
  2011-01-03  1:11 ` Jonathan Nieder
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marcin Wiśnicki @ 2011-01-03  0:42 UTC (permalink / raw)
  To: git

I'm trying to exclude certain paths (those that contain "xmac/gen/") from 
diff output using .git/info/attributes (not .gitattributes).

According to gitattributes(5) it supports patterns from gitignore(5).

Example path that must be excluded:
src/byucc/jhdl/CSRC/xmac/gen/and2_dp_g.xmac

What I've tried but didn't work:
xmac/gen/ -diff

Following works but is not what I want:
*.xmac -diff

It seems I can only get it to work for file names but not for whole paths.
What am I doing wrong or is this a bug ?

git version 1.7.3.4

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

* Re: gitattributes don't work
  2011-01-03  0:42 gitattributes don't work Marcin Wiśnicki
@ 2011-01-03  1:11 ` Jonathan Nieder
  2011-01-03  4:34 ` Nguyen Thai Ngoc Duy
  2011-01-04 18:33 ` Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Nieder @ 2011-01-03  1:11 UTC (permalink / raw)
  To: Marcin Wiśnicki; +Cc: git, Nguyễn Thái Ngọc Duy

Marcin Wiśnicki wrote:

> I'm trying to exclude certain paths (those that contain "xmac/gen/") from 
> diff output using .git/info/attributes (not .gitattributes).

Tricky.  Have you tried

 xmac?gen? -diff

?  You might also be interested in the nd/struct-pathspec branch:

 git clone git://repo.or.cz/git.git
 cd git
 git log --grep=nd/struct-pathspec

for some work and explanation on patterns used to specify paths.

Regards,
Jonathan

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

* Re: gitattributes don't work
  2011-01-03  0:42 gitattributes don't work Marcin Wiśnicki
  2011-01-03  1:11 ` Jonathan Nieder
@ 2011-01-03  4:34 ` Nguyen Thai Ngoc Duy
  2011-01-04  2:16   ` Marcin Wiśnicki
  2011-01-04 18:33 ` Junio C Hamano
  2 siblings, 1 reply; 5+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-01-03  4:34 UTC (permalink / raw)
  To: Marcin Wiśnicki; +Cc: git, Joshua Jensen

2011/1/3 Marcin Wiśnicki <mwisnicki@gmail.com>:
> I'm trying to exclude certain paths (those that contain "xmac/gen/") from
> diff output using .git/info/attributes (not .gitattributes).
>
> According to gitattributes(5) it supports patterns from gitignore(5).
>
> Example path that must be excluded:
> src/byucc/jhdl/CSRC/xmac/gen/and2_dp_g.xmac
>
> What I've tried but didn't work:
> xmac/gen/ -diff
>
> Following works but is not what I want:
> *.xmac -diff
>
> It seems I can only get it to work for file names but not for whole paths.
> What am I doing wrong or is this a bug ?

While gitattributes(5) says that, actually gitattributes and gitignore
use different matching implementations. gitattributes one seems
unchanged since its introduction in d0bfd02 (Add basic infrastructure
to assign attributes to paths - 2007-04-12). gitignore on the other
hand learned foo/ pattern later in d6b8fc3 (gitignore(5): Allow "foo/"
in ignore list to match directory "foo" - 2008-01-31).

Yeah, it looks like a bug to me. A better way to solve this once and
for all, is to unify the two implementations (which is good for
gitattr because there have been optimizations added to gitignore). I
tried long ago and gave up. Something to do with the order of matching
(gitignore tries inner directories first, while gitattr starts from
outer ones).

For the time being, anyone who changes gitignore should be reminded to
consider whether it's applicable to gitattributes and vice versa.

Which reminds me, Joshua, maybe you should add case-insensitive
support to gitattributes too ;-)
-- 
Duy

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

* Re: gitattributes don't work
  2011-01-03  4:34 ` Nguyen Thai Ngoc Duy
@ 2011-01-04  2:16   ` Marcin Wiśnicki
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Wiśnicki @ 2011-01-04  2:16 UTC (permalink / raw)
  To: git

On Mon, 03 Jan 2011 11:34:00 +0700, Nguyen Thai Ngoc Duy wrote:

> 2011/1/3 Marcin Wiśnicki <mwisnicki@gmail.com>:
>>
>> According to gitattributes(5) it supports patterns from gitignore(5).
> 
> While gitattributes(5) says that, actually gitattributes and gitignore
> [snip]
> Yeah, it looks like a bug to me. A better way to solve this once and for
> [snip]
> For the time being, anyone who changes gitignore should be reminded to
> consider whether it's applicable to gitattributes and vice versa.

I think that for the time being at least the manual page must change to 
reflect reality.

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

* Re: gitattributes don't work
  2011-01-03  0:42 gitattributes don't work Marcin Wiśnicki
  2011-01-03  1:11 ` Jonathan Nieder
  2011-01-03  4:34 ` Nguyen Thai Ngoc Duy
@ 2011-01-04 18:33 ` Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2011-01-04 18:33 UTC (permalink / raw)
  To: Marcin Wiśnicki; +Cc: git

Marcin Wiśnicki <mwisnicki@gmail.com> writes:

> I'm trying to exclude certain paths (those that contain "xmac/gen/") from 
> diff output using .git/info/attributes (not .gitattributes).
>
> According to gitattributes(5) it supports patterns from gitignore(5).
>
> Example path that must be excluded:
> src/byucc/jhdl/CSRC/xmac/gen/and2_dp_g.xmac
>
> What I've tried but didn't work:
> xmac/gen/ -diff

Why not "xmac/gen/* -diff" or even "xmac/gen/*.xmac -diff"?

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

end of thread, other threads:[~2011-01-04 18:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03  0:42 gitattributes don't work Marcin Wiśnicki
2011-01-03  1:11 ` Jonathan Nieder
2011-01-03  4:34 ` Nguyen Thai Ngoc Duy
2011-01-04  2:16   ` Marcin Wiśnicki
2011-01-04 18:33 ` Junio C Hamano

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).