Increasing robustness of the metadata file
The metadata file stores the git hash that HEAD was pointing to when Alamo was compiled. When a simulation is run, a patch file generated from git diff is written if the working tree is "dirty" and has changes not tracked by the recorded commit. This, ostensibly, allows a user to go back and time and exactly recreate a simulation.
Often times, these simulations are run off a feature or investigation branch, not development or master. In these cases, it is possible a developer may rebase their branch before merging into development potentially "erasing" the commit hash that the metadata file points to and the corresponding diff.patch was based off.
Recommended solution
I recommend adding diff logic to do something like this:
git diff --patch --output development.patch --minimal --patch-with-stat --full-index --binary --find-copies-harder --merge-base origin/development
Additionally, the metadata file should store the common ancestor of HEAD with origin/development. This can be determined with: git merge-base origin/development HEAD.
In effect, this would write an additional .patch file that is based off the common ancestor of whatever branch HEAD points to and the development branch. Since development is unlikely to be rebased, this virtually eliminates the risk of losing record of git hashes.
To recreate the working tree as it was when the simulation was ran, one would check out the common ancestor commit (given by git merge-base origin/development HEAD) and then apply the patch.
Additional recommendations
I recommend adding the flags --patch --minimal --patch-with-stat --full-index --binary --find-copies-harder to the existing diff command that generates diff.patch. These flags
--minimal: optimize the diff
--patch-with-stat: write some human-readable output to the top of the diff
--full-index: record full index hashes
--binary: track any binary files (e.g., PNG files)
--find-copies-harder: optimize the diff
Increasing robustness of the
metadatafileThe
metadatafile stores the git hash thatHEADwas pointing to when Alamo was compiled. When a simulation is run, a patch file generated fromgit diffis written if the working tree is "dirty" and has changes not tracked by the recorded commit. This, ostensibly, allows a user to go back and time and exactly recreate a simulation.Often times, these simulations are run off a feature or investigation branch, not
developmentormaster. In these cases, it is possible a developer may rebase their branch before merging intodevelopmentpotentially "erasing" the commit hash that themetadatafile points to and the correspondingdiff.patchwas based off.Recommended solution
I recommend adding diff logic to do something like this:
Additionally, the
metadatafile should store the common ancestor ofHEADwithorigin/development. This can be determined with:git merge-base origin/development HEAD.In effect, this would write an additional
.patchfile that is based off the common ancestor of whatever branchHEADpoints to and thedevelopmentbranch. Sincedevelopmentis unlikely to be rebased, this virtually eliminates the risk of losing record of git hashes.To recreate the working tree as it was when the simulation was ran, one would check out the common ancestor commit (given by
git merge-base origin/development HEAD) and then apply the patch.Additional recommendations
I recommend adding the flags
--patch --minimal --patch-with-stat --full-index --binary --find-copies-harderto the existing diff command that generatesdiff.patch. These flags--minimal: optimize the diff--patch-with-stat: write some human-readable output to the top of the diff--full-index: record full index hashes--binary: track any binary files (e.g., PNG files)--find-copies-harder: optimize the diff