Skip to content

Commit 99b4669

Browse files
committed
Give fingerprints a distinct prefix
1 parent f3aeeca commit 99b4669

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/libfetchers/git-utils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ ref<GitRepo> GitRepo::openRepo(const std::filesystem::path & path, bool create,
740740

741741
std::string GitAccessorOptions::makeFingerprint(const Hash & rev) const
742742
{
743-
return rev.gitRev() + (exportIgnore ? ";e" : "") + (smudgeLfs ? ";l" : "");
743+
return "git:" + rev.gitRev() + (exportIgnore ? ";e" : "") + (smudgeLfs ? ";l" : "");
744744
}
745745

746746
/**

src/libfetchers/github.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ struct GitArchiveInputScheme : InputScheme
350350
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
351351
{
352352
if (auto rev = input.getRev())
353-
return rev->gitRev();
353+
return "github:" + rev->gitRev();
354354
else
355355
return std::nullopt;
356356
}

src/libfetchers/mercurial.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ struct MercurialInputScheme : InputScheme
345345
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
346346
{
347347
if (auto rev = input.getRev())
348-
return rev->gitRev();
348+
return "hg:" + rev->gitRev();
349349
else
350350
return std::nullopt;
351351
}

src/libfetchers/tarball.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ struct TarballInputScheme : CurlInputScheme
407407
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
408408
{
409409
if (auto narHash = input.getNarHash())
410-
return narHash->to_string(HashFormat::SRI, true);
410+
return "tarball:" + narHash->to_string(HashFormat::SRI, true);
411411
else if (auto rev = input.getRev())
412-
return rev->gitRev();
412+
return "tarball:" + rev->gitRev();
413413
else
414414
return std::nullopt;
415415
}

0 commit comments

Comments
 (0)