lib: refactor commitIdFromGitRepo with fileContents

+3 -3
+3 -3
lib/sources.nix
··· 44 44 packedRefsName = toString path + "/packed-refs"; 45 45 in if lib.pathExists fileName 46 46 then 47 - let fileContent = readFile fileName; 47 + let fileContent = lib.fileContents fileName; 48 48 # Sometimes git stores the commitId directly in the file but 49 49 # sometimes it stores something like: «ref: refs/heads/branch-name» 50 - matchRef = match "^ref: (.*)\n$" fileContent; 50 + matchRef = match "^ref: (.*)$" fileContent; 51 51 in if isNull matchRef 52 - then lib.removeSuffix "\n" fileContent 52 + then fileContent 53 53 else readCommitFromFile path (lib.head matchRef) 54 54 # Sometimes, the file isn't there at all and has been packed away in the 55 55 # packed-refs file, so we have to grep through it: