Add test case for clone head detached repo

Signed-off-by: Frank Li <lznuaa@gmail.com>