diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs index 03b2b593b70..e3b796a03bb 100644 --- a/src/librustpkg/source_control.rs +++ b/src/librustpkg/source_control.rs @@ -10,7 +10,8 @@ // Utils for working with version control repositories. Just git right now. -use std::{io, os, run, str}; +use std::{os, run, str}; +use std::run::{ProcessOutput, ProcessOptions, Process}; use version::*; /// For a local git repo @@ -47,7 +48,7 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool { else { match v { &ExactRevision(ref s) | &Tagged(ref s) => { - let outp = run::process_output_in_cwd("git", [~"checkout", fmt!("tags/%s", *s)], + let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)], target); if outp.status != 0 { debug!(str::from_bytes_owned(outp.output.clone())); @@ -63,6 +64,12 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool { } } +fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput { + let mut prog = Process::new(prog, args, ProcessOptions{ dir: Some(cwd) + ,..ProcessOptions::new()}); + prog.finish_with_output() +} + pub fn is_git_dir(p: &Path) -> bool { os::path_is_dir(&p.push(".git")) } diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 4e91fd514c8..594298331b7 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -1029,6 +1029,6 @@ fn test_non_numeric_tag() { "test_pkg", "testbranch_only"]); let file2 = repo.push_many(["mockgithub.com", "catamorphism", "test_pkg", "master_only"]); - assert!(os::path_exists(&file1));' + assert!(os::path_exists(&file1)); assert!(!os::path_exists(&file2)); }