Skip to content

Commit

Permalink
fix(remote): it didn't parse project false that didn't start with /
Browse files Browse the repository at this point in the history
  • Loading branch information
alesbrelih committed Oct 20, 2024
1 parent 782f854 commit 28e8fff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gitlab_ci_ls_parser/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ impl Git for GitImpl {
let files = files
.iter()
.filter_map(|file| {
// TODO: dirty hack, fix it when time
let file = prepend_if_needed(file, '/');
let file_path = format!("{repo_dest}{file}");
debug!("filepath: {}", file_path);

Expand Down Expand Up @@ -404,6 +406,14 @@ impl Git for GitImpl {
}
}

fn prepend_if_needed(input: &str, character: char) -> String {
if input.starts_with(character) {
input.to_string()
} else {
format!("{character}{input}")
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 28e8fff

Please sign in to comment.