Skip to content

Commit

Permalink
Remove tarball-cache.{hh,cc}
Browse files Browse the repository at this point in the history
TarballInfo is only used in github.cc, and getTarballCache() is a bit
too trivial to have its own file.
  • Loading branch information
edolstra committed Feb 15, 2024
1 parent 9b04ce1 commit 78b8db7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
7 changes: 7 additions & 0 deletions src/libfetchers/git-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -986,4 +986,11 @@ std::vector<std::tuple<GitRepoImpl::Submodule, Hash>> GitRepoImpl::getSubmodules
return result;
}

ref<GitRepo> getTarballCache()
{
static auto repoDir = std::filesystem::path(getCacheDir()) / "nix" / "tarball-cache";

return GitRepo::openRepo(repoDir, true, true);
}

}
2 changes: 2 additions & 0 deletions src/libfetchers/git-utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ struct GitRepo
const std::vector<fetchers::PublicKey> & publicKeys) = 0;
};

ref<GitRepo> getTarballCache();

}
7 changes: 6 additions & 1 deletion src/libfetchers/github.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "tarball.hh"
#include "tarfile.hh"
#include "git-utils.hh"
#include "tarball-cache.hh"

#include <optional>
#include <nlohmann/json.hpp>
Expand Down Expand Up @@ -193,6 +192,12 @@ struct GitArchiveInputScheme : InputScheme

virtual DownloadUrl getDownloadUrl(const Input & input) const = 0;

struct TarballInfo
{
Hash treeHash;
time_t lastModified;
};

std::pair<Input, TarballInfo> downloadArchive(ref<Store> store, Input input) const
{
if (!maybeGetStrAttr(input.attrs, "ref")) input.attrs.insert_or_assign("ref", "HEAD");
Expand Down
13 changes: 0 additions & 13 deletions src/libfetchers/tarball-cache.cc

This file was deleted.

17 changes: 0 additions & 17 deletions src/libfetchers/tarball-cache.hh

This file was deleted.

0 comments on commit 78b8db7

Please sign in to comment.