Skip to content

Commit faaf15b

Browse files
Elly Jonesgraydon
authored andcommitted
---
yaml --- r: 6647 b: refs/heads/master c: f05eaa4 h: refs/heads/master i: 6645: 11b07e0 6643: bbfd343 6639: c0d2165 v: v3
1 parent f99a0da commit faaf15b

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0acf170c9f9cd1c666a163657678ddec2366e0a3
2+
refs/heads/master: f05eaa4a650132174a43113e7bf1bce293515428

trunk/src/cargo/cargo.rs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,15 @@ 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-
}
197+
fn install_git(c: cargo, wd: str, _path: str) {
198+
run::run_program("git", ["clone", _path, wd]);
199+
install_source(c, wd);
206200
}
207201

208-
fn install_file(c: cargo, _path: str) {
209-
let wd = tempfile::mkdtemp(c.workdir + fs::path_sep(), "");
210-
alt wd {
211-
some(p) {
212-
run::run_program("tar", ["-x", "--strip-components=1",
213-
"-C", p, "-f", _path]);
214-
install_source(c, p);
215-
}
216-
_ { fail "needed temp dir"; }
217-
}
202+
fn install_file(c: cargo, wd: str, _path: str) {
203+
run::run_program("tar", ["-x", "--strip-components=1",
204+
"-C", wd, "-f", _path]);
205+
install_source(c, wd);
218206
}
219207

220208
fn cmd_install(c: cargo, argv: [str]) {
@@ -224,12 +212,19 @@ fn cmd_install(c: cargo, argv: [str]) {
224212
ret;
225213
}
226214

215+
let wd = alt tempfile::mkdtemp(c.workdir + fs::path_sep(), "") {
216+
some(_wd) { _wd }
217+
none. { fail "needed temp dir"; }
218+
};
219+
227220
if str::starts_with(argv[2], "git:") {
228-
install_git(c, argv[2]);
229-
}
230-
if str::starts_with(argv[2], "file:") {
221+
install_git(c, wd, argv[2]);
222+
} else if str::starts_with(argv[2], "github:") {
223+
let path = rest(argv[2], 7u);
224+
install_git(c, wd, "git://github.com/" + path);
225+
} else if str::starts_with(argv[2], "file:") {
231226
let path = rest(argv[2], 5u);
232-
install_file(c, path);
227+
install_file(c, wd, path);
233228
}
234229
}
235230

0 commit comments

Comments
 (0)