Previous change to amend tried to eliminate a double-call
of write-tree, which was both used to elide the final cherrypick
as well as make the temp commit that is used for cherry-picking.
However it erroneously didn't set the top tree for the len == 1
case which meant that amends of HEAD itself did not actually
do any amending.
Fix this by writing the tree in the correct line, and pointing
the temp commit to that tree. This still manages to avoid a
double call to write-tree. Because drop is always false when
making the temp commit, we know the tree must have been written
earlier.
Previous change to amend tried to eliminate a double-call of write-tree, which was both used to elide the final cherrypick as well as make the temp commit that is used for cherry-picking. However it erroneously didn't set the top tree for the len == 1 case which meant that amends of HEAD itself did not actually do any amending.
Fix this by writing the tree in the correct line, and pointing the temp commit to that tree. This still manages to avoid a double call to write-tree. Because drop is always false when making the temp commit, we know the tree must have been written earlier.