Unverified Commit 7d4c10b9 authored by Anderson Torres's avatar Anderson Torres Committed by GitHub
Browse files

Merge pull request #199795 from NixOS/revert-199772-removeusagesoftostringonpath

Revert "lib,doc: remove obvious usages of toString on paths"
parents 9eb107c5 4b59590a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ let
      substr = builtins.substring prefixLen filenameLen filename;
      in substr;

  removeNixpkgs = removeFilenamePrefix pkgs.path;
  removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path);

  liblocations =
    builtins.filter
+5 −5
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ let
      origSrc = if isFiltered then src.origSrc else src;
    in lib.cleanSourceWith {
      filter = (path: type:
        let relPath = lib.removePrefix (origSrc + "/") (path);
        let relPath = lib.removePrefix (toString origSrc + "/") (toString path);
        in lib.any (re: match re relPath != null) regexes);
      inherit src;
    };
@@ -175,12 +175,12 @@ let
  */
  commitIdFromGitRepo =
    let readCommitFromFile = file: path:
        let fileName       = path + "/" + file;
            packedRefsName = path + "/packed-refs";
        let fileName       = toString path + "/" + file;
            packedRefsName = toString path + "/packed-refs";
            absolutePath   = base: path:
              if lib.hasPrefix "/" path
              then path
              else /. + "${base}/${path}";
              else toString (/. + "${base}/${path}");
        in if pathIsRegularFile path
           # Resolve git worktrees. See gitrepository-layout(5)
           then
@@ -226,7 +226,7 @@ let

  pathHasContext = builtins.hasContext or (lib.hasPrefix storeDir);

  canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext src);
  canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src));

  # -------------------------------------------------------------------------- #
  # Internal functions
+2 −2
Original line number Diff line number Diff line
@@ -213,8 +213,8 @@ rec {
    # Default value to return if revision can not be determined
    default:
    let
      revisionFile = ./.. + "/.git-revision";
      gitRepo      = ./.. + "/.git";
      revisionFile = "${toString ./..}/.git-revision";
      gitRepo      = "${toString ./..}/.git";
    in if lib.pathIsGitRepo gitRepo
       then lib.commitIdFromGitRepo gitRepo
       else if lib.pathExists revisionFile then lib.fileContents revisionFile