@@ -640,8 +640,11 @@ struct GitInputScheme : InputScheme
640640
641641 std::string makeFingerprint (const Input & input, const Hash & rev) const
642642 {
643- return rev.gitRev () + (getSubmodulesAttr (input) ? " ;s" : " " ) + (getExportIgnoreAttr (input) ? " ;e" : " " )
644- + (getLfsAttr (input) ? " ;l" : " " );
643+ auto options = GitAccessorOptions{
644+ .exportIgnore = getExportIgnoreAttr (input),
645+ .smudgeLfs = getLfsAttr (input),
646+ };
647+ return options.makeFingerprint (rev) + (getSubmodulesAttr (input) ? " ;s" : " " );
645648 }
646649
647650 std::pair<ref<SourceAccessor>, Input>
@@ -786,23 +789,24 @@ struct GitInputScheme : InputScheme
786789
787790 verifyCommit (input, repo);
788791
789- bool exportIgnore = getExportIgnoreAttr (input);
790- bool smudgeLfs = getLfsAttr (input);
791- auto accessor = repo->getAccessor (
792- rev, {.exportIgnore = exportIgnore, .smudgeLfs = smudgeLfs}, " «" + input.to_string (true ) + " »" );
792+ GitAccessorOptions options{
793+ .exportIgnore = getExportIgnoreAttr (input),
794+ .smudgeLfs = getLfsAttr (input),
795+ };
796+ auto accessor = repo->getAccessor (rev, options, " «" + input.to_string (true ) + " »" );
793797
794798 /* Backward compatibility hack for locks produced by Nix < 2.20 that depend on Nix applying Git filters or
795799 * `export-ignore`. Nix >= 2.20 doesn't do those, so we may get a NAR hash mismatch. If that happens, try again
796800 * with filters and export-ignore enabled. */
797801 if (auto expectedNarHash = input.getNarHash ()) {
798802 if (accessor->pathExists (CanonPath (" .gitattributes" ))) {
799- accessor->fingerprint = makeFingerprint (input, rev);
803+ accessor->fingerprint = options. makeFingerprint (rev);
800804 auto narHashNew =
801805 fetchToStore2 (settings, *store, {accessor}, FetchMode::DryRun, input.getName ()).second ;
802806 if (expectedNarHash != narHashNew) {
803- auto accessor2 = repo-> getAccessor (
804- rev, {. exportIgnore = true , . applyFilters = true } , " «" + input.to_string (true ) + " »" );
805- accessor2->fingerprint = makeFingerprint (input, rev) + " ;e;f " ;
807+ GitAccessorOptions options2{. exportIgnore = true , . applyFilters = true };
808+ auto accessor2 = repo-> getAccessor ( rev, options2 , " «" + input.to_string (true ) + " »" );
809+ accessor2->fingerprint = options2. makeFingerprint (rev);
806810 auto narHashOld =
807811 fetchToStore2 (settings, *store, {accessor2}, FetchMode::DryRun, input.getName ()).second ;
808812 if (expectedNarHash == narHashOld) {
@@ -814,6 +818,7 @@ struct GitInputScheme : InputScheme
814818 expectedNarHash->to_string (HashFormat::SRI, true ),
815819 narHashNew.to_string (HashFormat::SRI, true ));
816820 accessor = accessor2;
821+ options = options2;
817822 }
818823 }
819824 }
@@ -825,7 +830,7 @@ struct GitInputScheme : InputScheme
825830 if (getSubmodulesAttr (input)) {
826831 std::map<CanonPath, nix::ref<SourceAccessor>> mounts;
827832
828- for (auto & [submodule, submoduleRev] : repo->getSubmodules (rev, exportIgnore)) {
833+ for (auto & [submodule, submoduleRev] : repo->getSubmodules (rev, options. exportIgnore )) {
829834 auto resolved = repo->resolveSubmoduleUrl (submodule.url );
830835 debug (
831836 " Git submodule %s: %s %s %s -> %s" ,
@@ -848,9 +853,9 @@ struct GitInputScheme : InputScheme
848853 }
849854 }
850855 attrs.insert_or_assign (" rev" , submoduleRev.gitRev ());
851- attrs.insert_or_assign (" exportIgnore" , Explicit<bool >{exportIgnore});
856+ attrs.insert_or_assign (" exportIgnore" , Explicit<bool >{options. exportIgnore });
852857 attrs.insert_or_assign (" submodules" , Explicit<bool >{true });
853- attrs.insert_or_assign (" lfs" , Explicit<bool >{smudgeLfs});
858+ attrs.insert_or_assign (" lfs" , Explicit<bool >{options. smudgeLfs });
854859 attrs.insert_or_assign (" allRefs" , Explicit<bool >{true });
855860 auto submoduleInput = fetchers::Input::fromAttrs (settings, std::move (attrs));
856861 auto [submoduleAccessor, submoduleInput2] = submoduleInput.getAccessor (settings, store);
0 commit comments