Can the scriptrunner for bitbucket be used to lock checked out files

I would like to provide the ability to prevent two people from checking out the same file. If not, then prevent the commit by the second person.

Is this possible with Scriptrunner?

We are trying to support exclusive file locking through Bitbucket/GIT, we want to allow only one user to work on a file at a given time (in certain situations - binaries). This would be handled using the file locking facility (exclusive checkout). When userA exclusive checks out file1, no other user can checkout file1 and hence we do not encounter merge conflicts situation.

2 answers

1 accepted

1 vote

Hi Jodi,

As Daniel mentioned Git does not allow you to do this but Git LFS 2.0 onwards supports file locking. You can find out more about this here.

Information on enabling LFS support in Bitbucket Server can be found here.

It may be useful to know that ScriptRunner for Bitbucket Server has a pull request advisor hook to encourage developers to update their branch regularly to avoid large merge conflicts for non-binary files.

Hope this helps.

Adam

File locking support in Bitbucket is still an open request:

 https://jira.atlassian.com/browse/BSERV-9623

 

Our need is essentially around binary files only.

Hello Jodi.

This is frankly something that git isn't meant to do. Git is used to share code, including files and encountering merges and solving them.

You cannot prevent a user to checkout a commit, since git works with a local repo, and your local repo has no information about what other users have checked out, since they keep a local copy all of the time. Users pull the whole repo, not a part of it.

I am really confused as what it is you want to archieve and why, but I can assure you this is not what git is used for. I don't know if this is possible with our product, I honestly think that it isn't with git.

I hope this was helpful.

Cheers

Dyelamos

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
Bridget Sauer
Published 11 hours ago in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

35 views 0 3
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