aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/fetch-to-store.cc
blob: f830a496382f0d6b5601bdd2afc779e1cc17b7b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "fetch-to-store.hh"
#include "fetchers.hh"
#include "cache.hh"

namespace nix {

StorePath fetchToStore(
    Store & store,
    const SourcePath & path,
    std::string_view name,
    FileIngestionMethod method,
    PathFilter * filter,
    RepairFlag repair)
{
    Activity act(*logger, lvlChatty, actUnknown, fmt("copying '%s' to the store", path));

    auto filter2 = filter ? *filter : defaultPathFilter;

    return
        settings.readOnlyMode
        ? store.computeStorePathForPath(name, path.path.abs(), method, htSHA256, filter2).first
        : store.addToStore(name, path.path.abs(), method, htSHA256, filter2, repair);
}


}