Fixed an issue which caused tree metadata id to be lost

Tree metadata ids would be lost when resolving conflicts.  The new trees written when doing checkout --theirs or --ours would have a null metadata id.