How to restrict users from committing sources with CRLF or CR.


There is an option in git client (core.autocrlf). According to the option, all the sources should be committed to Git in Linux end-of-line style. According to Stash plugin API, there is not way to check EOL style of the files, as all the committed data is passed line-by-line, already splitted and already without EOL symbols.

How it is suggested to perform this restirction in Stash?

2 answers

1 accepted

Hi Pavel,

If you're happy to build a Stash plugin, you can skip the Stash service layer and use the GitCommandBuilderFactory to grab the raw diff from the underlying repository, as I described in this answer.

Alternatively, you could skip the Stash plugin API altogether install a git crlf hook in your repository on disk. This is a bit less desirable since it'll involve manually installing the hook in each repository you create in Stash.



Thanks a lot. This worked fine for me.

Pavel - what did you end up doing finally?  Is there a plugin that you can share?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,774 views 1 5
Read article

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