about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-07-26 12:31:53 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-07-26 12:31:53 -0700
commitc8780511b924705fbb567398e5201d9b492a2f32 (patch)
tree83fe418ff163311117d8de1ebaf727f81bee3b8a
parentbfac584a03f1e52808dc94aaa95703dd8847ab94 (diff)
downloadrust-c8780511b924705fbb567398e5201d9b492a2f32.tar.gz
rust-c8780511b924705fbb567398e5201d9b492a2f32.zip
rustpkg: Don't assume a non-numeric refspec is a tag
Just pass it directly to git, without prefixing it with tags/
-rw-r--r--src/librustpkg/source_control.rs11
-rw-r--r--src/librustpkg/tests.rs2
2 files changed, 10 insertions, 3 deletions
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));
 }