diff options
author | Gabriel Fontes <eu@misterio.me> | 2022-03-19 10:56:13 -0300 |
---|---|---|
committer | Gabriel Fontes <eu@misterio.me> | 2022-03-19 10:56:13 -0300 |
commit | 345a8ee0cb56775c57c3b7da99b0726290241e18 (patch) | |
tree | 419998051e062cc285eaefa63e4f98ff06dfb240 /src/libfetchers | |
parent | 8ad485ea893862029e02cb560a15fd276753b04f (diff) |
Fix sourcehut tag ref resolving
Diffstat (limited to 'src/libfetchers')
-rw-r--r-- | src/libfetchers/github.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index a1430f087..d52ea649d 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -390,7 +390,7 @@ struct SourceHutInputScheme : GitArchiveInputScheme ref_uri = line.substr(ref_index+5, line.length()-1); } else - ref_uri = fmt("refs/heads/%s", ref); + ref_uri = fmt("refs/(heads|tags)/%s", ref); auto file = store->toRealPath( downloadFile(store, fmt("%s/info/refs", base_url), "source", false, headers).storePath); @@ -399,9 +399,9 @@ struct SourceHutInputScheme : GitArchiveInputScheme std::string line; std::string id; while(getline(is, line)) { - auto index = line.find(ref_uri); - if (index != std::string::npos) { - id = line.substr(0, index-1); + std::regex pattern(ref_uri); + if (std::regex_search(line, pattern)) { + id = line.substr(0, line.find('\t')); break; } } |