christiangalsterer / stash-filehooks-plugin

An Atlassian Stash plugin to check on various file attributes, like size, name
Apache License 2.0
14 stars 27 forks source link

[Feature Request] Reject commits with a matching file name ONLY if said file is being modified #13

Open otherguy opened 8 years ago

otherguy commented 8 years ago

Reject commits with a matching file name ONLY if said file is being modified, i.e. not if the file is being created.

christiangalsterer commented 8 years ago

@darkwinternight: What would be the use case to check only for modified files? Please also note that once a file is added to git it stays in the history.

otherguy commented 8 years ago

My specific use case would be database migration scripts. My coworkers sometimes ahem edit old database migration scripts which then don't get run on production deployments, breaking a site.

People should be able to add files but not modify or delete them. All my database migration scripts have a specific filename pattern and I can write a regex for that.

christiangalsterer commented 8 years ago

Thanks for providing some inside into the use case. Shouldn't be too complicated to implement. I will try to look into it in the next days.

christiangalsterer commented 8 years ago

BTW: Which version do you currently use?

christiangalsterer commented 8 years ago

What about moving a file? Should this be possible?

otherguy commented 8 years ago

Bamboo 5.10.1.1 File Hooks Plugin 2.2.0

otherguy commented 8 years ago

Well at least in my case, once a file has been pushed, it should never be touched. Deletion, modification and moving of the file shouldn't be possible (if I need to rollback a database migration, the migration script needs to exist).

From a UX perspective of your plugin, it would be nice to have checkboxes next to the regex field (adding, modifying, deleting, ...) that would restrict the match to the type of action that is being performed on the file.

I.e.: