Git: What’s the path separator used in the content of the .gitHEAD in Git repositories on Windows?

  .git-folder, git, symbolic-references, windows

The title says it all, but for example, if the HEAD of a Git repository points to ref/heads/master on any well-used Git implementation for Windows, which of the following is the content of the file .git/HEAD … oops, .gitHEAD:

  • ref: refs/heads/master, or
  • ref: refsheadsmaster ?

Either way, I need to calculate the absolute path <git project>.gitrefsheadsmaster, but I don’t have Windows environment and I can’t get to know which form is used! Answer is greatly appreciated.

Background: I’m modifying a Haskell library implementing a macro that embeds the Git revision hashes of Haskell projects into their source codes right on compilation (very nice for implementing --version option!). When we compile the program invocating that macro, git is called; however even before that, when a build tool is checking whether recompilation is required, we cannot call git and all that’s done is simple file update check! Therefore, at the time of each compilation, we must compute and save the path of reference file at which HEAD is pointing, so that the reference file would be checked for update next time. The problem is that I would like to make the library cross-platform but that I don’t know how to compute the path of a reference file on Windows, for I don’t know the original form.

Source: StackOverflow