anchor.diff:             then
                let m   = match "^gitdir: (.*)$" (lib.fileContents path);
                in if m == null
  -                then throw ("File contains no gitdir reference: " + path)
  +                then { error = "File contains no gitdir reference: " + path; }
                   else
                     let gitDir      = absolutePath (dirOf path) (lib.head m);
                         commonDir'' = if pathIsRegularFile "${gitDir}/commondir"
  
positive.code:              let fileContent = lib.fileContents fileName;
                   matchRef    = match "^ref: (.*)$" fileContent;
               in if  matchRef == null
                  then fileContent
                  else readCommitFromFile (lib.head matchRef) path
  
             else if pathIsRegularFile packedRefsName
  
negative.code:       in type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts;
      in cleanSourceWith { inherit filter src; };
  
    pathIsGitRepo = path: (commitIdFromGitRepoOrError path)?value;
  
    /*
      Get the commit id of a git repo.
  
      Example: commitIdFromGitRepo <nixpkgs/.git>
    */
    commitIdFromGitRepo = path:
      let commitIdOrError = commitIdFromGitRepoOrError path;
      in commitIdOrError.value or (throw commitIdOrError.error);
  
    /*
      Get the commit id of a git repo.
  
      Returns `{ value = commitHash }` or `{ error = "... message ..." }`.
  
      Example: commitIdFromGitRepo <nixpkgs/.git>
    */
    commitIdFromGitRepoOrError =
      let readCommitFromFile = file: path:
          let fileName       = path + "/${file}";
              packedRefsName = path + "/packed-refs";
  