Supporting detached head state (when HEAD points directly to a SHA1 and not a branch reference) in FileSystem and Memory Git repos