Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Oct 28, 2023
1 parent f026356 commit e4caf21
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/libfetchers/git.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,6 @@ struct GitInputScheme : InputScheme

std::string name = input.getName();

auto makeResult = [&](const Attrs & infoAttrs, ref<InputAccessor> accessor) -> std::pair<ref<InputAccessor>, Input>
{
assert(input.getRev());
assert(!origRev || origRev == input.getRev());
if (!repoInfo.shallow)
input.attrs.insert_or_assign("revCount", getIntAttr(infoAttrs, "revCount"));
input.attrs.insert_or_assign("lastModified", getIntAttr(infoAttrs, "lastModified"));

return {accessor, std::move(input)};
};

auto originalRef = input.getRef();
auto ref = originalRef ? *originalRef : getDefaultRef(repoInfo);
input.attrs.insert_or_assign("ref", ref);
Expand Down Expand Up @@ -558,7 +547,13 @@ struct GitInputScheme : InputScheme
}
}

return makeResult(infoAttrs, accessor);
assert(input.getRev());
assert(!origRev || origRev == input.getRev());
if (!repoInfo.shallow)
input.attrs.insert_or_assign("revCount", getIntAttr(infoAttrs, "revCount"));
input.attrs.insert_or_assign("lastModified", getIntAttr(infoAttrs, "lastModified"));

return {accessor, std::move(input)};
}

std::pair<ref<InputAccessor>, Input> getAccessorFromWorkdir(
Expand Down

0 comments on commit e4caf21

Please sign in to comment.