Interactive External Hooks

I would like to add a hook that warns the user when they are pushing a binary encoded file.  I do not want to block the push explicitly, but would like to prompt the user (via the command line) that they are checking in a binary file, and allow them to interactively allow or disallow the commit via the prompt.  The documentation said there were examples on giving the user output, but was wondering if there was an example for prompting the user for information as well, or if this is even allowed with this plugin?

Thanks for your help!  Also, great plugin!

1 answer

1 accepted

No, there is no way to read data from user, because it's not allowed by specification of git push protocol/git push command implementation.

However, you can implement simple countdown and slightly suspend push process with notifying user that he is just about of pushing binary blob.

 

I've done it for checking coding standards.

You need to package this as a pre-receive plugin that never rejects commits. The output you want to show to the user has to go to hookResponse.out().

Thanks! I'll look into both of these methods.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,026 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you