Fix issues related to git updates

We observed that after updating the git repo in a test, unless we waited
for 1s, we got intermittent cases where a subsequent update of the git
source would not pick up the changes.

We observed this both with the git CLI and the branch using libgit2.
There may be a better solution, but we did not find it.
This commit is contained in:
Yehuda Katz + Carl Lerche 2014-08-14 17:05:01 -07:00 committed by Tim Carey-Smith
parent 8dad784e34
commit abe2686caf

View file

@ -1,4 +1,6 @@
use std::io::File;
use std::io::timer;
use std::time::Duration;
use support::{ProjectBuilder, ResultTest, project, execs, main_file, paths};
use support::{cargo_dir, path2url};
@ -659,6 +661,9 @@ test!(update_with_shared_deps {
git_project.process("git").args(["add", "."]).exec_with_output().assert();
git_project.process("git").args(["commit", "-m", "test"]).exec_with_output()
.assert();
timer::sleep(Duration::milliseconds(1000));
assert_that(p.process(cargo_dir().join("cargo-update")).arg("dep1"),
execs().with_stdout(format!("{} git repository `{}`",
UPDATING,
@ -824,6 +829,9 @@ test!(stale_cached_version {
bar.process("git").args(["add", "."]).exec_with_output().assert();
bar.process("git").args(["commit", "-m", "test"]).exec_with_output()
.assert();
timer::sleep(Duration::milliseconds(1000));
let rev = bar.process("git").args(["rev-parse", "HEAD"])
.exec_with_output().assert();
let rev = String::from_utf8(rev.output).unwrap();