Skip to content

Commit 0acf170

Browse files
Elly Jonesgraydon
Elly Jones
authored andcommitted
cargo: support git:// URIs.
1 parent b53e4e8 commit 0acf170

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/cargo/cargo.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,17 @@ fn install_source(c: cargo, path: str) {
194194
}
195195
}
196196

197+
fn install_git(c: cargo, _path: str) {
198+
let wd = tempfile::mkdtemp(c.workdir + fs::path_sep(), "");
199+
alt wd {
200+
some(p) {
201+
run::run_program("git", ["clone", _path, p]);
202+
install_source(c, p);
203+
}
204+
_ { fail "needed temp dir"; }
205+
}
206+
}
207+
197208
fn install_file(c: cargo, _path: str) {
198209
let wd = tempfile::mkdtemp(c.workdir + fs::path_sep(), "");
199210
alt wd {
@@ -213,6 +224,9 @@ fn cmd_install(c: cargo, argv: [str]) {
213224
ret;
214225
}
215226

227+
if str::starts_with(argv[2], "git:") {
228+
install_git(c, argv[2]);
229+
}
216230
if str::starts_with(argv[2], "file:") {
217231
let path = rest(argv[2], 5u);
218232
install_file(c, path);

0 commit comments

Comments
 (0)