10
10
11
11
// Utils for working with version control repositories. Just git right now.
12
12
13
- use std:: { io, os, run, str} ;
13
+ use std:: { os, run, str} ;
14
+ use std:: run:: { ProcessOutput , ProcessOptions , Process } ;
14
15
use version:: * ;
15
16
16
17
/// For a local git repo
@@ -47,7 +48,7 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
47
48
else {
48
49
match v {
49
50
& 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) ] ,
51
52
target) ;
52
53
if outp. status != 0 {
53
54
debug ! ( str :: from_bytes_owned( outp. output. clone( ) ) ) ;
@@ -63,6 +64,12 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {
63
64
}
64
65
}
65
66
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
+
66
73
pub fn is_git_dir ( p : & Path ) -> bool {
67
74
os:: path_is_dir ( & p. push ( ".git" ) )
68
75
}
0 commit comments