···4444 packedRefsName = toString path + "/packed-refs";
4545 in if lib.pathExists fileName
4646 then
4747- let fileContent = readFile fileName;
4747+ let fileContent = lib.fileContents fileName;
4848 # Sometimes git stores the commitId directly in the file but
4949 # sometimes it stores something like: «ref: refs/heads/branch-name»
5050- matchRef = match "^ref: (.*)\n$" fileContent;
5050+ matchRef = match "^ref: (.*)$" fileContent;
5151 in if isNull matchRef
5252- then lib.removeSuffix "\n" fileContent
5252+ then fileContent
5353 else readCommitFromFile path (lib.head matchRef)
5454 # Sometimes, the file isn't there at all and has been packed away in the
5555 # packed-refs file, so we have to grep through it: