Fix VersionedMetaData for multiple commits in one batch

I noticed that if you make a modification to the notes tree
(i.e. insert comments) and then make a modification to the commit at
the meta ref (i.e. insert approvals) within one BatchMetaDataUpdate,
then the notes tree update will be squashed by the second update. I
added tests to show this case and corrected this by using the tree
from the parent commit unless there are new contents in the DirCache
to be written.

Change-Id: I83f09e08f472c21dc4bc06f00c3706a18d170f9c
3 files changed