@@ -8,7 +8,7 @@ use std::fs;
8
8
9
9
use cargo_test_support:: git;
10
10
use cargo_test_support:: registry:: { self , Package , RegistryBuilder } ;
11
- use cargo_test_support:: { basic_lib_manifest, paths, project, Project } ;
11
+ use cargo_test_support:: { basic_lib_manifest, basic_manifest , paths, project, Project } ;
12
12
13
13
#[ cargo_test]
14
14
fn vendor_simple ( ) {
@@ -675,6 +675,60 @@ fn git_simple() {
675
675
assert ! ( csum. contains( "\" package\" :null" ) ) ;
676
676
}
677
677
678
+ #[ cargo_test]
679
+ fn git_diff_rev ( ) {
680
+ let ( git_project, git_repo) = git:: new_repo ( "git" , |p| {
681
+ p. file ( "Cargo.toml" , & basic_manifest ( "a" , "0.1.0" ) )
682
+ . file ( "src/lib.rs" , "" )
683
+ } ) ;
684
+ let url = git_project. url ( ) ;
685
+ let ref_1 = "v0.1.0" ;
686
+ let ref_2 = "v0.2.0" ;
687
+
688
+ git:: tag ( & git_repo, ref_1) ;
689
+
690
+ git_project. change_file ( "Cargo.toml" , & basic_manifest ( "a" , "0.2.0" ) ) ;
691
+ git:: add ( & git_repo) ;
692
+ git:: commit ( & git_repo) ;
693
+ git:: tag ( & git_repo, ref_2) ;
694
+
695
+ let p = project ( )
696
+ . file (
697
+ "Cargo.toml" ,
698
+ & format ! (
699
+ r#"
700
+ [package]
701
+ name = "foo"
702
+ version = "0.1.0"
703
+
704
+ [dependencies]
705
+ a_1 = {{ package = "a", git = '{url}', rev = '{ref_1}' }}
706
+ a_2 = {{ package = "a", git = '{url}', rev = '{ref_2}' }}
707
+ "#
708
+ ) ,
709
+ )
710
+ . file ( "src/lib.rs" , "" )
711
+ . build ( ) ;
712
+
713
+ p. cargo ( "vendor --respect-source-config" )
714
+ . with_stdout (
715
+ r#"[source."git+file://[..]/git?rev=v0.1.0"]
716
+ git = [..]
717
+ rev = "v0.1.0"
718
+ replace-with = "vendored-sources"
719
+
720
+ [source."git+file://[..]/git?rev=v0.2.0"]
721
+ git = [..]
722
+ rev = "v0.2.0"
723
+ replace-with = "vendored-sources"
724
+
725
+ [source.vendored-sources]
726
+ directory = "vendor"
727
+ "# ,
728
+ )
729
+ . run ( ) ;
730
+ }
731
+
678
732
#[ cargo_test]
679
733
fn git_duplicate ( ) {
680
734
let git = git:: new ( "a" , |p| {
0 commit comments