I'm trying to add a checked out Git repository to my Perforce depot. Don't get me wrong: no integration between Git and Perforce, I just want to put an external Git repo there so that I can access it like a Git repo and use pull/push and other Git actions as usual.
Inside the .git folder, I submitted everything except TortoiseGit-specific files and the hooks folder.
However, when I download that Git repo to a Perforce workspace on another PC, git status
tells me 'atal: Reference has invalid format: 'refs/remotes/origin/master
. All four files called master look okay, the file .git\refs\remotes\origin\master
for instance contains a commit hash followed by a Windows newline.
What am I doing wrong?
Okay, that one was rather obvious. Perforce is stupid and converts line-endings automatically by default. See here. Can be changed in the advanced workspace options.
Git doesn't like Windows-style newlines in .git/*
files and even worse, if for example all source code has LF newlines and Perforce converts them to CRLF, then your whole Git working tree will be marked as modified. YAY! (Of course a good VCS like Git gives you the option "checkout as-is, commit as-is" which is the only option that makes sense.)