Move repositories to subdirectories in history

Change the history of the cloned repositories and move them to the
requested subdirectories.
Added tests