[client] Update index after syncing with existing folder.
[client] Improve clone procedure.

* Don't checkout/merge if remote root is empty.
* Delete repo information in db before clone, if the repo was corrupt.