public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Gelonida <gelonida@gmail•com>
To: git@vger•kernel.org
Subject: simple example for git hooks
Date: Fri, 03 Sep 2010 00:41:31 +0200	[thread overview]
Message-ID: <i5p96s$u7q$1@dough.gmane.org> (raw)

Does anyone have a simple example of a git pre-commit hook


I have difficulties finding understandable tutorals about git hooks.




What I am looking at is basic examples about


precommit hooks
================

- how get the commit comment and check it's contents
- how to get list of modified files

The issue I'm currently blocked with is rather simple.

I'd like to get a list aof all
new or modified file names, such, that I can check, that for  example
all .h files contain a project specific header.


As soon as I have the file names I should be able to proceed.


How could I do this best from a shell script.





Is there any clear documentation about hich git commands I'm allowed to
use during a trigger script and which ones I can't



Lateron I would be interested to implement a small server script, that
refuses a git push in case, that the most recent commit in a branch
would contain .h files without a certain header text




thanks for your help

             reply	other threads:[~2010-09-02 22:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02 22:41 Gelonida [this message]
2010-09-02 22:49 ` simple example for git hooks Ævar Arnfjörð Bjarmason
2010-09-02 22:54   ` Gelonida
2010-09-03  9:43     ` Knut Franke
2010-09-03 20:37 ` Neal Kreitzinger
2010-09-05 21:48 ` Gelonida

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='i5p96s$u7q$1@dough.gmane.org' \
    --to=gelonida@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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