MCPcopy Create free account
hub / github.com/emwalker/digraph / url_paths

Method url_paths

backend/src/git/search.rs:474–510  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

472 }
473
474 fn url_paths(&self) -> Result<UrlMatches> {
475 let mut urls = HashSet::new();
476 for url in &self.search.urls {
477 urls.insert(url.normalized.to_owned());
478 }
479
480 if urls.is_empty() {
481 return Ok(UrlMatches::allow_everything());
482 }
483
484 if urls.len() != 1 {
485 return Ok(UrlMatches::impossible_result());
486 }
487
488 match urls.iter().next() {
489 Some(url) => {
490 let mut ids = HashSet::new();
491 let url = match RepoUrl::parse(url) {
492 Ok(url) => url,
493 Err(err) => {
494 log::error!("search: problem parsing url: {}", err);
495 return Ok(UrlMatches::impossible_result());
496 }
497 };
498
499 let id = url.id()?;
500 ids.insert(id);
501
502 Ok(UrlMatches {
503 ids,
504 impossible_result: false,
505 })
506 }
507
508 None => Ok(UrlMatches::impossible_result()),
509 }
510 }
511}
512
513#[cfg(test)]

Callers 1

fetch_matchesMethod · 0.80

Calls 7

parseFunction · 0.85
insertMethod · 0.80
nextMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected