@@ -134,7 +134,7 @@ struct GitArchiveInputScheme : InputScheme
134134 return input;
135135 }
136136
137- ParsedURL toURL (const Input & input) const override
137+ ParsedURL toURL (const Input & input, bool abbreviate ) const override
138138 {
139139 auto owner = getStrAttr (input.attrs , " owner" );
140140 auto repo = getStrAttr (input.attrs , " repo" );
@@ -145,7 +145,7 @@ struct GitArchiveInputScheme : InputScheme
145145 if (ref)
146146 path.push_back (*ref);
147147 if (rev)
148- path.push_back (rev->to_string (HashFormat::Base16, false ));
148+ path.push_back (abbreviate ? rev->gitShortRev () : rev-> gitRev ( ));
149149 auto url = ParsedURL{
150150 .scheme = std::string{schemeName ()},
151151 .path = path,
@@ -324,8 +324,8 @@ struct GitArchiveInputScheme : InputScheme
324324#endif
325325 input.attrs .insert_or_assign (" lastModified" , uint64_t (tarballInfo.lastModified ));
326326
327- auto accessor =
328- input. settings -> getTarballCache ()-> getAccessor ( tarballInfo.treeHash , false , " «" + input.to_string () + " »" );
327+ auto accessor = input. settings -> getTarballCache ()-> getAccessor (
328+ tarballInfo.treeHash , false , " «" + input.to_string (true ) + " »" );
329329
330330 if (!input.settings ->trustTarballsFromGitForges )
331331 // FIXME: computing the NAR hash here is wasteful if
@@ -421,8 +421,7 @@ struct GitHubInputScheme : GitArchiveInputScheme
421421 : headers.empty () ? " https://%s/%s/%s/archive/%s.tar.gz"
422422 : " https://api.%s/repos/%s/%s/tarball/%s" ;
423423
424- const auto url =
425- fmt (urlFmt, host, getOwner (input), getRepo (input), input.getRev ()->to_string (HashFormat::Base16, false ));
424+ const auto url = fmt (urlFmt, host, getOwner (input), getRepo (input), input.getRev ()->gitRev ());
426425
427426 return DownloadUrl{parseURL (url), headers};
428427 }
@@ -501,7 +500,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
501500 host,
502501 getStrAttr (input.attrs , " owner" ),
503502 getStrAttr (input.attrs , " repo" ),
504- input.getRev ()->to_string (HashFormat::Base16, false ));
503+ input.getRev ()->gitRev ( ));
505504
506505 Headers headers = makeHeadersWithAuthTokens (*input.settings , host, input);
507506 return DownloadUrl{parseURL (url), headers};
@@ -593,7 +592,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme
593592 host,
594593 getStrAttr (input.attrs , " owner" ),
595594 getStrAttr (input.attrs , " repo" ),
596- input.getRev ()->to_string (HashFormat::Base16, false ));
595+ input.getRev ()->gitRev ( ));
597596
598597 Headers headers = makeHeadersWithAuthTokens (*input.settings , host, input);
599598 return DownloadUrl{parseURL (url), headers};
0 commit comments