git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH/WIP] attr: make attributes depend on file type
Date: Tue, 01 Mar 2011 08:46:39 +0100	[thread overview]
Message-ID: <4D6CA45F.5000001@drmicha.warpmail.net> (raw)
In-Reply-To: <7v39n8jbj2.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 28.02.2011 18:48:
> Jeff King <peff@peff.net> writes:
> 
>> The only downside is that it is technically a regression if somebody was
>> using gitattributes for the bizarrely named file "symlink:". It seems
>> pretty unlikely, but possibly we should be carving out a syntactic
>> namespace like:
>>
>>   ^[a-z]+:
>>
>> or even:
>>
>>   ^[a-z]+(=[^:]*)?:
> 
> Or even '^:[a-z]+(=[^,=])?(,[a-z]+(=[^,=])?)*:' to
> 
>  (1) always have some special character at the beginning, to limit the
>      extent of the damage to existing funny pathnames (i.e. to collide
>      your pathname must begin with such a special character).  This also
>      has a nice side effect of making it clear that something special is
>      going on; and
> 
>  (2) allow more than one such special on the line, comma-separated.
> 
> But that is just a small bikeshed.  Other than that, I like what Michael
> and you are aiming for (I am only commenting on the general direction at
> this moment, as I haven't looked at the patch at all yet).

Thanks, Junio, and Jeff, for the helpful comments. I isolated the naming
convention (now "symlink:") to a single spot in attr.c so that changing
it (then ":symlink:") is always simple while this develops. (I was
afraid that the low likelikehood that someone's file names would collide
could be too much already.)

Having a standard pattern applied to regular files only is an intended
side-effect; more precisely: to non-symlinks right now. We could tighten
that to IS_REG, of course, and easily add others (or :other:, :nonreg:).

What I really would need help with is checking all call sites of
git_checkattr(), which gained a new mode parameter: I used the proper
mode where available (from diff_filespec, e.g., i.e.: taking mode from
index or tree) or by looking it up in the fs (using lstat() in
builtin/check-attr.c), and I used mode=0 in other cases, assuming that
this conveys IS_REG and that we're sure those call sites are about
regular files or blobs. I tried to avoid unmotivated lstat().

Michael

  reply	other threads:[~2011-03-01  7:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26 13:16 git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-26 20:11 ` Junio C Hamano
2011-02-27 14:41   ` Michael J Gruber
2011-02-27 22:33     ` Mart Sõmermaa
2011-02-28  9:58       ` Michael J Gruber
2011-02-28 10:51         ` Mart Sõmermaa
2011-02-27 22:54     ` Junio C Hamano
2011-02-27 23:07       ` Junio C Hamano
2011-02-28  7:31         ` Michael J Gruber
2011-02-28 12:17           ` Jeff King
2011-02-28 12:23             ` Jeff King
2011-02-28 12:32               ` Michael J Gruber
2011-02-28 12:59                 ` Jeff King
2011-02-28 13:05                   ` Michael J Gruber
2011-02-28 21:54                     ` Jeff King
2011-02-28 18:11               ` Junio C Hamano
2011-02-28 22:23                 ` Jeff King
2011-02-28 23:28                   ` Junio C Hamano
2011-03-01  0:11                     ` Junio C Hamano
2011-03-07 20:38                       ` Mart Sõmermaa
2011-03-08  7:14                         ` Michael J Gruber
2011-03-08 19:49                         ` Junio C Hamano
2011-03-08 21:25                           ` Mart Sõmermaa
2011-03-08 21:31                             ` Jeff King
2011-02-28 12:42             ` symling diff driver (Was: Re: git diff: add option for omitting the contents of deletes) Michael J Gruber
2011-02-28 13:08               ` Jeff King
2011-02-28 15:26                 ` [PATCH/WIP] attr: make attributes depend on file type Michael J Gruber
2011-02-28 17:30                   ` Jeff King
2011-02-28 17:48                     ` Junio C Hamano
2011-03-01  7:46                       ` Michael J Gruber [this message]
2011-02-28 10:45         ` git diff: add option for omitting the contents of deletes Mart Sõmermaa
2011-02-28 16:10           ` Michael J Gruber

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=4D6CA45F.5000001@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.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).