Skip to content

Commit ec9252d

Browse files
committed
Set the Git fingerprint early
1 parent c35b682 commit ec9252d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/libfetchers/fetchers.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(const Settings
358358
try {
359359
auto [accessor, result] = scheme->getAccessor(settings, store, *this);
360360

361-
if (!accessor->fingerprint)
362-
accessor->fingerprint = result.getFingerprint(store);
361+
if (auto fp = accessor->getFingerprint(CanonPath::root).second)
362+
result.cachedFingerprint = *fp;
363363
else
364-
result.cachedFingerprint = accessor->fingerprint;
364+
accessor->fingerprint = result.getFingerprint(store);
365365

366366
return {accessor, std::move(result)};
367367
} catch (Error & e) {

src/libfetchers/git-utils.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ struct GitSourceAccessor : SourceAccessor
768768
.options = options,
769769
}}
770770
{
771+
fingerprint = options.makeFingerprint(rev);
771772
}
772773

773774
std::string readBlob(const CanonPath & path, bool symlink)

src/libfetchers/git.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,13 +800,11 @@ struct GitInputScheme : InputScheme
800800
* with filters and export-ignore enabled. */
801801
if (auto expectedNarHash = input.getNarHash()) {
802802
if (accessor->pathExists(CanonPath(".gitattributes"))) {
803-
accessor->fingerprint = options.makeFingerprint(rev);
804803
auto narHashNew =
805804
fetchToStore2(settings, *store, {accessor}, FetchMode::DryRun, input.getName()).second;
806805
if (expectedNarHash != narHashNew) {
807806
GitAccessorOptions options2{.exportIgnore = true, .applyFilters = true};
808807
auto accessor2 = repo->getAccessor(rev, options2, "«" + input.to_string(true) + "»");
809-
accessor2->fingerprint = options2.makeFingerprint(rev);
810808
auto narHashOld =
811809
fetchToStore2(settings, *store, {accessor2}, FetchMode::DryRun, input.getName()).second;
812810
if (expectedNarHash == narHashOld) {

0 commit comments

Comments
 (0)