plainblack.com
Username Password
search
Bookmark and Share

    

git pre-commit hook

User perlDreamer
Date 10/30/2009 7:19 pm
Views 616
Rating 1    Rate [
|
]
Previous · Next
User Message
perlDreamer

Yesterday, I committed a broken test.  Being the person who always encourages (nags) people to always run the tests before committing them, it was particularly embarrasing to find.

I did some digging around, and found that git committers can setup their own pre-commit hooks, so I wrote one that runs only the 00_compile.t test before allowing me to commit.  00_compile.t runs very quickly.

Git stores hooks in the .git directory for the repo, so you would add this file to as .git/hooks/pre-commit.

You'll need to modify it to point to some valid WebGUI configuration file.  The test does no database writes, so any configuration file will work.

 



Attached Files
Back to Top
Rate [
|
]
 
 
JT
I think this sounds like a great idea, but we should make it easier to  
add for developers. I'm thinking we should have a file in the  
repository with all our pre-commit hooks built in. And this file  
should be in the format that git is expecting (that shell script).  
Then the dev would only have to:

ln -s /data/WebGUI/path/to/pre-commit /data/WebGUI/.git/hooks/pre-commit

And they'd be done.


Back to Top
Rate [
|
]
 
 
    



© 2010 Plain Black Corporation | All Rights Reserved