How safe am I editing a repo config or adding bash hooks on the file system?

I'm currently hosting my own git repositories and am thinking of switching to stash. My first thought was to use my current config and hooks for a quicker switchover. I tested them and everything works fine but I am worried about stash coming through and wiping things out. Can I expect stash to respect my repository configurations on the file system or am I reliquishing all control?

1 answer

1 accepted

Hi Justin,

That depends slightly on what you mean 'config'? Certainly raw Git hooks are supported for the foreseeable future (although we always prefer the use of Stash hooks). You just need to make sure the hooks are in the special pre-receive.d and post-receive.d directories, rather than in 'hooks' as we need to override those - Stash will not function correctly otherwise.

As to the other configuration, it depends. For example we don't block mailmap configuration, as related to your previous Answer's question. But for doing merges and diffs we override certain configuration to ensure that Stash behaves correctly under all circumstances.

Does that make sense and answer your question?

Charles

I should add that we certainly prefer less interference with the raw Git repositories. We reserve the right to take control over Git configuration that Stash relies on it is more likely to behave as advertised with the standard values. Please be careful. :)

I also prefer less interference but I don't think we mean the same thing. ;)

Mostly I create my own sections for use in my hooks per repo. I configure all repos to use the same mailmap file so I could symlink them to .mailmap but config is cleaner imho. I also make use of aliases so I can use the same hooks across repos that have similar but not identical data.

I've got around 300 repos at this point with more coming all the time. If/When I switch to plugins it sure would be nice to be able to clone a std configuration like I do with bamboo or jira. At this point it'll be way easier to copy a script file.

Hi Justin,

You should be fine then. Let us know if something doesn't behave as you would expect.

At some point we would definitely like to improve the way our repository settings, including hooks, inherit their configuration from projects and the global scope. That's not likely to happen in the short term though.

Best of luck,

Charles

I think this is my last question on this topic:

I want to limit users abilities to rewrite history. Can I continue to do this in config as follows or is there a stashy way to do it?

[receive]
        denyDeleteCurrent = ignore
        denyNonFastForwards = true
        denyDeletes = false

Hi Justin,

Stash comes bundled with a per-repository hook that can disable fast forwards. Unfortunately it doesn't include branch deletion. My collegue has written an example plugin which might be of interest:

https://bitbucket.org/atlassianlabs/stash-refchange-settings-plugin/overview

You might also be interested in watching/voting for the following feature request:

https://jira.atlassian.com/browse/STASH-2507

Cheers,

Charles

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,857 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