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

Question about custom descriptor file manipulation

EricHickman April 29, 2015

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

1 vote
Adam
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 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.

0 votes
EricHickman May 27, 2015

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

Atlassian Community Events