Skip to content

Commit 7b36d66

Browse files
committed
Allow installing arbitrary git cargos
1 parent 68e5d8d commit 7b36d66

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/cargo/cargo.rs

+20
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,24 @@ fn cmd_install(c: cargo) unsafe {
713713
install_uuid(c, wd, uuid);
714714
}
715715
}
716+
} else if str::starts_with(target, "git:") {
717+
let ref = if c.opts.free.len() >= 4u {
718+
some(c.opts.free[3u])
719+
} else {
720+
none
721+
};
722+
install_git(c, wd, target, ref)
723+
} else if target == "git" {
724+
if c.opts.free.len() < 4u {
725+
fail #fmt("needed git url");
726+
}
727+
let url = c.opts.free[3u];
728+
let ref = if c.opts.free.len() >= 5u {
729+
some(c.opts.free[4u])
730+
} else {
731+
none
732+
};
733+
install_git(c, wd, url, ref)
716734
} else {
717735
let mut name = target;
718736
alt str::find_char(name, '/') {
@@ -891,6 +909,8 @@ Querying:
891909
Package installation:
892910
[options] [source/]PKGNAME Install a package by name
893911
[options] uuid:[source/]PKGUUID Install a package by uuid
912+
[options] git [url] [ref] Install a package by git
913+
[options] git://[url] [ref] Install a package by git
894914

895915
Package installation options:
896916
--mode=MODE Install to one of the following locations:

0 commit comments

Comments
 (0)