Skip to content

Commit c878051

Browse files
committed
rustpkg: Don't assume a non-numeric refspec is a tag
Just pass it directly to git, without prefixing it with tags/
1 parent bfac584 commit c878051

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustpkg/source_control.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
// Utils for working with version control repositories. Just git right now.
1212

13-
use std::{io, os, run, str};
13+
use std::{os, run, str};
14+
use std::run::{ProcessOutput, ProcessOptions, Process};
1415
use version::*;
1516

1617
/// For a local git repo
@@ -47,7 +48,7 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
4748
else {
4849
match v {
4950
&ExactRevision(ref s) | &Tagged(ref s) => {
50-
let outp = run::process_output_in_cwd("git", [~"checkout", fmt!("tags/%s", *s)],
51+
let outp = process_output_in_cwd("git", [~"checkout", fmt!("%s", *s)],
5152
target);
5253
if outp.status != 0 {
5354
debug!(str::from_bytes_owned(outp.output.clone()));
@@ -63,6 +64,12 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
6364
}
6465
}
6566

67+
fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput {
68+
let mut prog = Process::new(prog, args, ProcessOptions{ dir: Some(cwd)
69+
,..ProcessOptions::new()});
70+
prog.finish_with_output()
71+
}
72+
6673
pub fn is_git_dir(p: &Path) -> bool {
6774
os::path_is_dir(&p.push(".git"))
6875
}

src/librustpkg/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,6 @@ fn test_non_numeric_tag() {
10291029
"test_pkg", "testbranch_only"]);
10301030
let file2 = repo.push_many(["mockgithub.com", "catamorphism", "test_pkg",
10311031
"master_only"]);
1032-
assert!(os::path_exists(&file1));'
1032+
assert!(os::path_exists(&file1));
10331033
assert!(!os::path_exists(&file2));
10341034
}

0 commit comments

Comments
 (0)