Skip to content

Commit

Permalink
use Tree ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
mkenigs committed Jun 1, 2020
1 parent 7680993 commit 1e4c2de
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/libfetchers/fetchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const

auto actualPath = store->toRealPath(storePath);

return {fetchers::Tree { .actualPath = actualPath, .storePath = std::move(storePath) }, *this};
return {fetchers::Tree(std::move(actualPath), std::move(storePath)), *this};
} catch (Error & e) {
debug("substitution of input '%s' failed: %s", to_string(), e.what());
}
Expand Down
11 changes: 3 additions & 8 deletions src/libfetchers/git.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ struct GitInputScheme : InputScheme
input.attrs.insert_or_assign("revCount", getIntAttr(infoAttrs, "revCount"));
input.attrs.insert_or_assign("lastModified", getIntAttr(infoAttrs, "lastModified"));
return {
Tree {
.actualPath = store->toRealPath(storePath),
.storePath = std::move(storePath),
},
Tree(store->toRealPath(storePath), std::move(storePath)),
input
};
};
Expand Down Expand Up @@ -273,10 +270,8 @@ struct GitInputScheme : InputScheme
haveCommits ? std::stoull(runProgram("git", true, { "-C", actualUrl, "log", "-1", "--format=%ct", "HEAD" })) : 0);

return {
Tree {
.actualPath = store->printStorePath(storePath),
.storePath = std::move(storePath),
}, input
Tree(store->printStorePath(storePath), std::move(storePath)),
input
};
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/libfetchers/mercurial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ struct MercurialInputScheme : InputScheme

auto storePath = store->addToStore("source", actualUrl, true, htSHA256, filter);

return {Tree {
.actualPath = store->printStorePath(storePath),
.storePath = std::move(storePath),
}, input};
return {
Tree(store->printStorePath(storePath), std::move(storePath)),
input};
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/libfetchers/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ struct PathInputScheme : InputScheme
storePath = store->addToStore("source", path);

return {
Tree {
.actualPath = store->toRealPath(*storePath),
.storePath = std::move(*storePath),
},
Tree(store->toRealPath(*storePath), std::move(*storePath)),
input
};
}
Expand Down
10 changes: 2 additions & 8 deletions src/libfetchers/tarball.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ std::pair<Tree, time_t> downloadTarball(

if (cached && !cached->expired)
return {
Tree {
.actualPath = store->toRealPath(cached->storePath),
.storePath = std::move(cached->storePath),
},
Tree(store->toRealPath(cached->storePath), std::move(cached->storePath)),
getIntAttr(cached->infoAttrs, "lastModified")
};

Expand Down Expand Up @@ -157,10 +154,7 @@ std::pair<Tree, time_t> downloadTarball(
immutable);

return {
Tree {
.actualPath = store->toRealPath(*unpackedStorePath),
.storePath = std::move(*unpackedStorePath),
},
Tree(store->toRealPath(*unpackedStorePath), std::move(*unpackedStorePath)),
lastModified,
};
}
Expand Down

0 comments on commit 1e4c2de

Please sign in to comment.