git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jan Larres <jan@majutsushi.net>
Cc: git@vger.kernel.org
Subject: Re: check-attr doesn't respect recursive definitions
Date: Tue, 2 Apr 2013 10:31:30 -0400	[thread overview]
Message-ID: <20130402143130.GC23828@sigill.intra.peff.net> (raw)
In-Reply-To: <slrnkldd3g.1l4.jan@majutsushi.net>

On Sat, Mar 30, 2013 at 09:45:51AM +0000, Jan Larres wrote:

> I am trying to write a custom archiving script that checks the
> export-ignore attribute to know which files from an ls-files output it
> should skip. Through this I noticed that for files in directories for
> which the export-ignore (or any other) attribute is set, check-attr
> still reports 'unspecified'. More precisely:
> 
> $ git init test
> Initialized empty Git repository in /home/jan/test/.git/
> $ cd test
> $ mkdir foo
> $ touch foo/bar
> $ echo "foo export-ignore" > .gitattributes
> $ git check-attr export-ignore foo
> foo: export-ignore: set
> $ git check-attr export-ignore foo/bar
> foo/bar: export-ignore: unspecified
> 
> I would expect the last command to also report 'set'. I've also tried
> other patterns like 'foo/' and 'foo*', but it didn't make any
> difference. Is this expected behaviour? It does make checking the
> attributes of single files somewhat more difficult.

Yes, it is the expected behavior, though I cannot offhand think of
anything that would break if we did apply it recursively.

> git-archive ignores the directory as expected, but unfortunately it
> doesn't have an option to just list the files it would archive instead
> of actually archiving them.

Yes, git-archive feeds the directories into the attribute machinery as
it traverses the tree, so it actually checks for attributes of "foo"
before recursing. You can do the same, but I agree it is quite a bit
more annoying than just piping "ls-files -z" into "check-attr --stdin
-z".

-Peff

  reply	other threads:[~2013-04-02 14:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-30  9:45 check-attr doesn't respect recursive definitions Jan Larres
2013-04-02 14:31 ` Jeff King [this message]
2013-04-02 14:48   ` Jeff King
2013-04-02 16:11   ` Junio C Hamano
2013-04-02 16:30     ` Jeff King
2013-04-02 16:43       ` Junio C Hamano
2013-04-02 16:51         ` Jeff King
2013-04-02 17:15           ` Jeff King
2013-04-02 17:16           ` Junio C Hamano
2013-04-02 19:16             ` Jeff King
2013-04-03 10:05               ` Jan Larres
2013-04-05  2:09 ` Duy Nguyen
2013-04-05 12:04   ` Jan Larres

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130402143130.GC23828@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jan@majutsushi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).