Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

git - Handle multiple pre-commit hooks

I have a need to use multiple pre-commit hook scripts. Not sure how to handle them. Should all of them be combined into one single large pre-commit script ? if not, how to handle multiple pre-commit scripts ?

question from:https://stackoverflow.com/questions/26624368/handle-multiple-pre-commit-hooks

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Should all of them be combined into one single large pre-commit script ?

Yes and no: you can only declare one pre-commit script, so this script should be in charge to:

  • call the actual pre-commit scripts
  • chose an order for those scripts to be called.

So:

  • one pre-commit script
  • calling multiple scripts, each one allowing or not (with their exit status) the commit to proceed.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...