git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Plaksin <happy@usg.edu>
To: git@vger.kernel.org
Subject: Re: Syntax check via update hook?
Date: Thu, 14 May 2009 15:52:02 -0400	[thread overview]
Message-ID: <wsd4abfonx.fsf@usg.edu> (raw)
In-Reply-To: 20090514065544.GC10411@coredump.intra.peff.net

Jeff King <peff@peff.net> writes:

> On Tue, May 12, 2009 at 03:16:50PM -0400, Mark Plaksin wrote:
>
>> >         $ cat <<EOF >.git/hooks/update
>> >         #!/bin/sh
>> >         GIT_INDEX_FILE=/path/to/tempdir/index; export GIT_INDEX_FILE
>> >         cd /path/to/tempdir/tree &&
>> >         mkdir -p tree &&
>> >         git read-tree "$3" &&
>> >         git checkout-index &&
>> >         your_syntax_check
>> >         EOF
>> >         $ chmod +x .git/hooks/update
>> 
>> Thanks for helping! :)
>> 
>> Unfortunately we don't quite get it.  Can you flesh out your example a
>> bit and explain the concepts involved?  We're relative git newbies.  We
>> tried reading the man pages to the commands you use to no avail.  One
>> big stumbling block seems to be how we create/set-up tempdir.  Is that
>> supposed to be a pre-created git checkout, or created via git-archive,
>> or .. ?
>
> What I was trying to say earlier is that you have two choices based on
> how efficient you want to make it. The simple way is to use git-archive:

OK, this makes sense now.  Thanks for being patient with us :)

> However, all of that being said, if you just want:
>
>> Also, we actually just want to check the syntax of the files that were
>> changed in the commit, not the whole tree.  Will your method give us
>> access to the path names of the files that changed?
>
> That is simpler, especially if you can feed the files to your
> syntax-checker over stdin. You just need to enumerate the files, and
> then ask git to dump each one:

...

> Make sense?

It does!  You make it seem so easy!  Thanks very much.  I now have an
update hook which checks syntax just like we want.  Thanks again!

  reply	other threads:[~2009-05-14 19:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-08 19:43 Syntax check via update hook? Mark Plaksin
2009-05-09 14:47 ` Jeff King
2009-05-12 19:16   ` Mark Plaksin
2009-05-14  6:55     ` Jeff King
2009-05-14 19:52       ` Mark Plaksin [this message]
2009-05-20 15:13         ` Mark Plaksin
2009-05-20 15:22           ` Jeff King
2009-05-20 20:57             ` Mark Plaksin

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=wsd4abfonx.fsf@usg.edu \
    --to=happy@usg.edu \
    --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).