mirror of
https://github.com/rust-lang/cargo
synced 2024-10-03 22:43:59 +00:00
Roll back git2 a bit to fix tests
This commit is contained in:
parent
2430581a1c
commit
d5cb12cad2
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -5,7 +5,7 @@ dependencies = [
|
|||
"docopt 0.6.0 (git+https://github.com/burntsushi/docopt.rs#fc7ba2f1a5a351f7874257d880223d2ff5c75d36)",
|
||||
"docopt_macros 0.6.0 (git+https://github.com/burntsushi/docopt.rs#fc7ba2f1a5a351f7874257d880223d2ff5c75d36)",
|
||||
"flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs#12593d1b9ccf09c2eabac176a6e233b171eed843)",
|
||||
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#079938f9f2e376a95df96b13fa162573c2d1d568)",
|
||||
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#5d67a5ffda44569a5d016e8bc3aae7e57e6ca7f1)",
|
||||
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git#f0fd1546b0a7a278a12658ab8602b5c827cc3a42)",
|
||||
"semver 0.0.1 (git+https://github.com/rust-lang/semver#c78b40d7fdf8acd99b503e6ce394fbcf9eb8982f)",
|
||||
"tar 0.0.1 (git+https://github.com/alexcrichton/tar-rs#689bbc003ae47feae5bc99c53b56736e4ad994ba)",
|
||||
|
@ -39,9 +39,9 @@ source = "git+https://github.com/alexcrichton/flate2-rs#12593d1b9ccf09c2eabac176
|
|||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#079938f9f2e376a95df96b13fa162573c2d1d568"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#5d67a5ffda44569a5d016e8bc3aae7e57e6ca7f1"
|
||||
dependencies = [
|
||||
"libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#079938f9f2e376a95df96b13fa162573c2d1d568)",
|
||||
"libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#5d67a5ffda44569a5d016e8bc3aae7e57e6ca7f1)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -52,7 +52,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#f0fd1546b0a7a278a1
|
|||
[[package]]
|
||||
name = "libgit2"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#079938f9f2e376a95df96b13fa162573c2d1d568"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#5d67a5ffda44569a5d016e8bc3aae7e57e6ca7f1"
|
||||
dependencies = [
|
||||
"link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#f08103ea7d2e2d3369c2c5e66b0220c8d16b92c9)",
|
||||
]
|
||||
|
|
|
@ -244,8 +244,12 @@ impl<'a> GitCheckout<'a> {
|
|||
let repo = try!(GitCheckout::clone_repo(database.get_path(), into));
|
||||
let checkout = GitCheckout::new(into, database, revision, repo);
|
||||
|
||||
try!(checkout.reset());
|
||||
try!(checkout.update_submodules());
|
||||
try!(checkout.reset().chain_error(|| {
|
||||
internal("failed to reset to the right revision")
|
||||
}));
|
||||
try!(checkout.update_submodules().chain_error(|| {
|
||||
internal("failed to update submodules")
|
||||
}));
|
||||
|
||||
Ok(checkout)
|
||||
}
|
||||
|
@ -297,6 +301,9 @@ impl<'a> GitCheckout<'a> {
|
|||
|
||||
for mut child in try!(repo.submodules()).move_iter() {
|
||||
try!(child.init(false));
|
||||
let url = try!(child.url().require(|| {
|
||||
internal("non-utf8 url for submodule")
|
||||
}));
|
||||
|
||||
// A submodule which is listed in .gitmodules but not actually
|
||||
// checked out will not have a head id, so we should ignore it.
|
||||
|
@ -318,20 +325,17 @@ impl<'a> GitCheckout<'a> {
|
|||
}
|
||||
Err(..) => {
|
||||
let path = repo.path().dir_path().join(child.path());
|
||||
let url = try!(child.url().require(|| {
|
||||
internal("invalid submodule url")
|
||||
}));
|
||||
try!(git2::Repository::clone(url, &path))
|
||||
}
|
||||
};
|
||||
|
||||
// Fetch data from origin and reset to the head commit
|
||||
let url = try!(child.url().require(|| {
|
||||
internal("repo with non-utf8 url")
|
||||
}));
|
||||
let refspec = "refs/heads/*:refs/heads/*";
|
||||
let mut remote = try!(repo.remote_create_anonymous(url, refspec));
|
||||
try!(remote.fetch(sig, None));
|
||||
try!(remote.fetch(sig, None).chain_error(|| {
|
||||
internal(format!("failed to fetch submodule `{}` from {}",
|
||||
child.name().unwrap_or(""), url))
|
||||
}));
|
||||
|
||||
let obj = try!(git2::Object::lookup(&repo, head, None));
|
||||
try!(repo.reset(&obj, git2::Hard, sig, None));
|
||||
|
|
|
@ -738,19 +738,23 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
|
|||
doctest = DOCTEST,
|
||||
dir = p.url()).as_slice()));
|
||||
p.root().move_into_the_past().assert();
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("bench").arg("-v"),
|
||||
execs().with_status(0)
|
||||
.with_stdout(format!("\
|
||||
{running} [..]
|
||||
{running} [..]
|
||||
{running} [..]
|
||||
{running} [..]
|
||||
{fresh} bar v0.0.1 ({dir})
|
||||
{fresh} foo v0.0.1 ({dir})
|
||||
{running} target[..]release[..]bench-[..]
|
||||
{running} [..]target[..]release[..]bench-[..]
|
||||
|
||||
running 1 test
|
||||
test foo ... bench: 0 ns/iter (+/- 0)
|
||||
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
|
||||
|
||||
{running} target[..]release[..]foo-[..]
|
||||
{running} [..]target[..]release[..]foo-[..]
|
||||
|
||||
running 1 test
|
||||
test foo ... bench: 0 ns/iter (+/- 0)
|
||||
|
@ -758,6 +762,7 @@ test foo ... bench: 0 ns/iter (+/- 0)
|
|||
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
|
||||
|
||||
{doctest} foo
|
||||
{running} [..]
|
||||
|
||||
running 0 tests
|
||||
|
||||
|
|
|
@ -891,7 +891,8 @@ test!(dep_with_changed_submodule {
|
|||
}).assert();
|
||||
|
||||
git_project.process("git").args(["submodule", "add"])
|
||||
.arg(git_project2.root()).arg("src").exec_with_output().assert();
|
||||
.arg(git_project2.url().to_string()).arg("src").exec_with_output()
|
||||
.assert();
|
||||
git_project.process("git").args(["add", "."]).exec_with_output().assert();
|
||||
git_project.process("git").args(["commit", "-m", "test"]).exec_with_output()
|
||||
.assert();
|
||||
|
@ -910,6 +911,7 @@ test!(dep_with_changed_submodule {
|
|||
pub fn main() { println!(\"{}\", dep1::dep()) }
|
||||
");
|
||||
|
||||
println!("first run");
|
||||
assert_that(project.cargo_process("run"), execs()
|
||||
.with_stdout(format!("{} git repository `[..]`\n\
|
||||
{} dep1 v0.5.0 ([..])\n\
|
||||
|
@ -939,23 +941,22 @@ test!(dep_with_changed_submodule {
|
|||
|
||||
timer::sleep(Duration::milliseconds(1000));
|
||||
// Update the dependency and carry on!
|
||||
assert_that(project.process(cargo_dir().join("cargo")).arg("update"), execs()
|
||||
println!("update");
|
||||
assert_that(project.process(cargo_dir().join("cargo")).arg("update").arg("-v"),
|
||||
execs()
|
||||
.with_stderr("")
|
||||
.with_stdout(format!("{} git repository `{}`",
|
||||
UPDATING,
|
||||
git_project.url())));
|
||||
|
||||
assert_that(project.cargo_process("run"), execs()
|
||||
.with_stdout(format!("{} git repository `[..]`\n\
|
||||
{} dep1 v0.5.0 ([..])\n\
|
||||
{} foo v0.5.0 ([..])\n\
|
||||
{} `target[..]foo`\n\
|
||||
println!("last run");
|
||||
assert_that(project.process(cargo_dir().join("cargo")).arg("run"), execs()
|
||||
.with_stdout(format!("{compiling} dep1 v0.5.0 ([..])\n\
|
||||
{compiling} foo v0.5.0 ([..])\n\
|
||||
{running} `target[..]foo`\n\
|
||||
project3\
|
||||
",
|
||||
UPDATING,
|
||||
COMPILING,
|
||||
COMPILING,
|
||||
RUNNING))
|
||||
compiling = COMPILING, running = RUNNING))
|
||||
.with_stderr("")
|
||||
.with_status(0));
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue