git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Eli Barzilay <eli@barzilay.org>
Cc: git@vger.kernel.org
Subject: Re: `git check-attr' problems & questions
Date: Sat, 27 Mar 2010 20:42:08 -0500	[thread overview]
Message-ID: <20100328014208.GA23015@progeny.tock> (raw)
In-Reply-To: <m3iq8jn3ar.fsf@winooski.ccs.neu.edu>

Hi,

[quoted text reordered for convenience]

Eli Barzilay wrote:

> I'm trying to use .gitattributes to use some custom properties that we
> have in an svn repository which is migrating to git,
[...]
> So my first question is -- am I missing something obvious?  It almost
> looks like `check-attr' is intended only for low-level use...

Yep.  It’s listed under “purehelpers” (Internal helper commands) in
command-list.txt and hence git(1).  I suspect a good place to put
a user-visible equivalent would be a future ‘git ls’ command [1].

Therefore...

> Fixing the first problem seems like it would be easy with a quick
> shell script (maybe even with just an alias),

If it proves pleasant to use, it would be very nice if you could send
a copy of such a shell script after a while.  Experiments like this
are the foundation of a good UI.

> 2. I'm also trying to use an attribute on a hook script on the server
>    (with the idea that email notifications are sent according to the
>    set of modified files) -- but it looks like `git check-attr'
>    doesn't work on a bare repository.

Current ‘git check-attr’ reads its attributes from actual .gitattribute
files in the work tree first and then examines the versions registered
in the index.  So the secret is to read the .gitattribute files you care
about into a temporary index file --- e.g., something like this.

 : "Usage: $0 commit check-attr-args" &&

 GIT_INDEX=tmp-index git read-tree --reset -i "$1" &&
 shift &&
 GIT_INDEX=tmp-index git check-attr "$@" &&
 rm tmp-index

Ideally, check-attr should learn an option to set a different policy
(e.g., index-only) with git_attr_set_direction(), but that is a
different story.

>    instead of showing an error, it actually succeeds after
>    showing that the attribute is "unspecified".

Probably it should learn to error out when it expects to use a work
tree but there is none.  git_attr_set_direction() does this.

> And the last question -- is there anything that does something like
> this customized email notifications that I'm trying to do?  (That is:
> an attribute that determines recipients, then a `post-receive' hook
> that builds a list of modified files, grabs all the corresponding
> values of this attributes, and that's makes up the recipient list to
> notify.)

Not that I know of.

HTH,
Jonathan

[1] I read the name from here:
http://thread.gmane.org/gmane.comp.version-control.git/136360
That series went in a different direction, though.
http://thread.gmane.org/gmane.comp.version-control.git/141678

  reply	other threads:[~2010-03-28  1:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26  3:57 `git check-attr' problems & questions Eli Barzilay
2010-03-28  1:42 ` Jonathan Nieder [this message]
2010-03-29 15:28   ` Eli Barzilay
2010-03-29 16:09     ` Eli Barzilay
2010-03-29 23:15       ` git check-attr in bare repositories Jonathan Nieder
2010-03-30  4:53         ` Eli Barzilay
2010-03-30 21:22           ` Jonathan Nieder
2010-03-30 21:39             ` Jakub Narebski
2010-03-31  3:15               ` Eli Barzilay
2010-03-30 21:30           ` Carrying over attributes when moving files Jonathan Nieder
2010-03-31  3:30             ` Eli Barzilay
2010-03-31  4:05             ` Junio C Hamano

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=20100328014208.GA23015@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=eli@barzilay.org \
    --cc=git@vger.kernel.org \
    /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).