Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Justin Shapiro
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2013

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

0 votes
Answer accepted
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2013

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

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2013

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. :)

Justin Shapiro
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2013

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.

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2013

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

Justin Shapiro
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2013

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

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2013

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
TAGS
AUG Leaders

Atlassian Community Events