Question about custom descriptor file manipulation

We are implementing a file storage system via Stash, and what we are replacing now uses a descriptor file. This file, called deployment.xml, contains configuration information for our other processes such as documenting production transfers. Ideally, we would require the deployers to include this .xml file with every push, and we currently have a pre-receive hook implemented that will block a push if it doesn't contain it. The second, and more tricky, part is to remove the deployment.xml file from their repository, and move it to a different directory on our Linux file system. What would a good way to implement this be? A pre or post receive hook? Should we look at implementing a shell script on the back end that moves the file? Any assistance or ideas would be appreciated.

2 answers

This widget could not be displayed.
Adam Ahmed Atlassian Team Apr 29, 2015

If I understand you correctly, I don't think there's a good way to do that. Removing files from the repository necessarily changes the commit hash. So your options would be to either:

  1. amend the commit as soon as it's received, causing the developer who pushed it to no longer have the same code as your server has. (and pulling it will merge the commits, causing the old commit to be added back to the repository anyway - they'd have to rebase after every push).
  2. push a new commit on top of it that removes the deployment.xml file. they'd have to pull after every push. This wouldn't remove the file from history though - it'd still exist in the repository at the older commit.

Are you sure you don't want to copy the XML file to a new directory? Is it necessary that you remove the file from the repository?

Something like 

git show master:deployment.xml > /other/dir/deployment.xml

should do the trick for copying.

This widget could not be displayed.

Sorry for the late response. Thank you for your answer, it started a conversation with my team about how we wanted to process this information. If I wanted to use that git command in a java pre-receive hook similar to this other resource I've been using: https://bitbucket.org/atlassianlabs/stash-filesize-hook-plugin/src/cd31c72b002c0337a7bb93b0ae30c13af0a77f6e/src/main/java/com/atlassian/stash/plugin/filesize/FilesizeHook.java?at=master    how would I do that?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,218 views 8 11
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