Skip to content

Commit 0ef37e3

Browse files
committed
fix: support trailing slash in origin url
1 parent d3c5540 commit 0ef37e3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/run/helpers/parse_git_remote.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use lazy_static::lazy_static;
33

44
lazy_static! {
55
static ref REMOTE_REGEX: regex::Regex = regex::Regex::new(
6-
r"(?P<domain>[^/@\.]+\.\w+)[:/](?P<owner>[^/]+)/(?P<repository>[^/]+?)(\.git)?$"
6+
r"(?P<domain>[^/@\.]+\.\w+)[:/](?P<owner>[^/]+)/(?P<repository>[^/]+?)(\.git)?/?$"
77
)
88
.unwrap();
99
}
@@ -89,5 +89,15 @@ mod tests {
8989
repository: "runner",
9090
}
9191
"###);
92+
93+
let remote = "https://github.com/codspeed/runner/";
94+
let git_remote = parse_git_remote(remote).unwrap();
95+
insta::assert_debug_snapshot!(git_remote, @r###"
96+
GitRemote {
97+
domain: "github.com",
98+
owner: "codspeed",
99+
repository: "runner",
100+
}
101+
"###);
92102
}
93103
}

0 commit comments

Comments
 (0)