From 3b45475f7565cb8fef3f29ad26dfbde5bdc348a7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 10 Aug 2022 16:51:45 +0200 Subject: [PATCH] Remove Input::hasAllInfo() --- src/libfetchers/fetchers.cc | 10 ---------- src/libfetchers/fetchers.hh | 4 ---- src/libfetchers/git.cc | 9 --------- src/libfetchers/github.cc | 7 ------- src/libfetchers/indirect.cc | 5 ----- src/libfetchers/mercurial.cc | 7 ------- src/libfetchers/path.cc | 5 ----- src/libfetchers/tarball.cc | 5 ----- 8 files changed, 52 deletions(-) diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index e3232ce1d..e69898c2b 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -101,11 +101,6 @@ std::optional Input::isRelative() const return scheme->isRelative(*this); } -bool Input::hasAllInfo() const -{ - return getNarHash() && scheme && scheme->hasAllInfo(*this); -} - bool Input::operator ==(const Input & other) const { return attrs == other.attrs; @@ -170,11 +165,6 @@ void Input::checkLocks(Input & input) const throw Error("'revCount' attribute mismatch in input '%s', expected %d", input.to_string(), *prevRevCount); } - - // FIXME - #if 0 - assert(input.hasAllInfo()); - #endif } std::pair, Input> Input::getAccessor(ref store) const diff --git a/src/libfetchers/fetchers.hh b/src/libfetchers/fetchers.hh index 85214af12..4d1e829f0 100644 --- a/src/libfetchers/fetchers.hh +++ b/src/libfetchers/fetchers.hh @@ -55,8 +55,6 @@ public: relative path, i.e. './foo'. */ std::optional isRelative() const; - bool hasAllInfo() const; - bool operator ==(const Input & other) const; bool contains(const Input & other) const; @@ -119,8 +117,6 @@ struct InputScheme virtual ParsedURL toURL(const Input & input) const; - virtual bool hasAllInfo(const Input & input) const = 0; - virtual Input applyOverrides( const Input & input, std::optional ref, diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc index 697e87f28..181507b18 100644 --- a/src/libfetchers/git.cc +++ b/src/libfetchers/git.cc @@ -204,15 +204,6 @@ struct GitInputScheme : InputScheme return url; } - bool hasAllInfo(const Input & input) const override - { - bool maybeDirty = !input.getRef(); - bool shallow = maybeGetBoolAttr(input.attrs, "shallow").value_or(false); - return - maybeGetIntAttr(input.attrs, "lastModified") - && (shallow || maybeDirty || maybeGetIntAttr(input.attrs, "revCount")); - } - Input applyOverrides( const Input & input, std::optional ref, diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 9f61c0331..b00609f73 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -134,13 +134,6 @@ struct GitArchiveInputScheme : InputScheme }; } - bool hasAllInfo(const Input & input) const override - { - return input.getRev() && - true; // FIXME - //maybeGetIntAttr(input.attrs, "lastModified"); - } - Input applyOverrides( const Input & _input, std::optional ref, diff --git a/src/libfetchers/indirect.cc b/src/libfetchers/indirect.cc index d0d0f4af8..3ce57fe2d 100644 --- a/src/libfetchers/indirect.cc +++ b/src/libfetchers/indirect.cc @@ -76,11 +76,6 @@ struct IndirectInputScheme : InputScheme return url; } - bool hasAllInfo(const Input & input) const override - { - return false; - } - Input applyOverrides( const Input & _input, std::optional ref, diff --git a/src/libfetchers/mercurial.cc b/src/libfetchers/mercurial.cc index 7139abdcb..cb7122eeb 100644 --- a/src/libfetchers/mercurial.cc +++ b/src/libfetchers/mercurial.cc @@ -98,13 +98,6 @@ struct MercurialInputScheme : InputScheme return url; } - bool hasAllInfo(const Input & input) const override - { - // FIXME: ugly, need to distinguish between dirty and clean - // default trees. - return input.getRef() == "default" || maybeGetIntAttr(input.attrs, "revCount"); - } - Input applyOverrides( const Input & input, std::optional ref, diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc index 831e15a77..3cb4dad02 100644 --- a/src/libfetchers/path.cc +++ b/src/libfetchers/path.cc @@ -84,11 +84,6 @@ struct PathInputScheme : InputScheme return (bool) input.getNarHash(); } - bool hasAllInfo(const Input & input) const override - { - return true; - } - void putFile( const Input & input, const CanonPath & path, diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc index 010d71dba..a28de44c7 100644 --- a/src/libfetchers/tarball.cc +++ b/src/libfetchers/tarball.cc @@ -232,11 +232,6 @@ struct CurlInputScheme : InputScheme return url; } - bool hasAllInfo(const Input & input) const override - { - return true; - } - bool isLocked(const Input & input) const override { return (bool) input.getNarHash();