[client] Fix a few bugs in merge.

* Still update index entry if checkout file fails;
* Always clean when merge with an empty folder.
[client] Handle minor bug when deleting empty dir.