0

I use Bamboo CI to manage my git repos for Salesforce development. It runs my tests after each commit and if successful, then deploys to an org. This all works wonderfully except for when I've deleted files, because Salesforce needs a special xml built-up in order to remove them from the org.

What I want to know is how I can add a step to my build process that will extract a list of any files which have been removed from git since the last build. I can handle the parsing of that information myself, but how can I get it?

Note: The deployments only run when things are stable, meaning that there might be many commits between last run and current run. Bamboo does provide variables for current revision number and previous revision number, so how could I use that to my advantage?

RenegadeCoder
  • 166
  • 1
  • 7

2 Answers2

0

You can get a list of the deleted files from the latest commit using git show and grep:

  > git show --summary HEAD | grep "delete mode"
   delete mode 100755 test.file
jas_raj
  • 1,131
  • 6
  • 14
  • The deployments only run when things are stable, meaning that there might be many commits between last run and current run. Bamboo provides variables for current revision number and previous revision number, so how could I use this example with that info factored in? – RenegadeCoder Jan 15 '15 at 16:54
  • You can use `...` to get all the changes between the 2 version numbers you have: `git show --summary ver1...ver2 | grep "delete mode"` – jas_raj Jan 15 '15 at 17:49
0

Solved it using

git log --pretty=format: --name-only --diff-filter=D ${bamboo.repository.previous.revision.number}..HEAD --summary | sort -u > removals.txt

results in a nice clean output of removed files

RenegadeCoder
  • 166
  • 1
  • 7