Compare to v2, this round does more refactoring, which makes cmd_clone() looks easier to follow in the end, in my opinion. There's also 7/10 that refuses --branch=<nonexistent>. I don't know if I react too strong. The current behavior is fall back to remote's HEAD (and detached HEAD if remote's HEAD is detached). Maybe we should only refuse it when it leads to detached HEAD and let it fall back to remote's HEAD otherwise. The last two patches remain debatable. If we disallow detached HEAD from new clones, perhaps we could put <tag>^{commit} to refs/heads/master then drop the last patch. t3501.6, t5527.2, t5707.5, t7406.29 likes to have detached HEAD, but those can be fixed. Nguyễn Thái Ngọc Duy (10): t5601: add missing && cascade clone: write detached HEAD in bare repositories clone: factor out checkout code clone: factor out HEAD update code clone: factor out remote ref writing clone: delay cloning until after remote HEAD checking clone: --branch=<branch> always means refs/heads/<branch> clone: refuse to clone if --branch points to bogus ref clone: allow --branch to take a tag clone: print advice on checking out detached HEAD Documentation/git-clone.txt | 5 +- advice.c | 14 +++ advice.h | 1 + builtin/checkout.c | 16 +--- builtin/clone.c | 252 +++++++++++++++++++++++++------------------ t/t5601-clone.sh | 40 ++++++- t/t5706-clone-branch.sh | 8 +- transport.c | 5 +- 8 files changed, 207 insertions(+), 134 deletions(-) -- 1.7.3.1.256.g2539c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html