@@ -806,6 +806,84 @@ Caused by:
806
806
. run ( ) ;
807
807
}
808
808
809
+ #[ cargo_test]
810
+ #[ cfg( not( windows) ) ] // https://github.com/libgit2/libgit2/issues/6250
811
+ /// Test that /dir and /dir/ matches symlinks to directories.
812
+ fn gitignore_symlink_dir ( ) {
813
+ if !symlink_supported ( ) {
814
+ return ;
815
+ }
816
+
817
+ let ( p, _repo) = git:: new_repo ( "foo" , |p| {
818
+ p. file ( "src/main.rs" , r#"fn main() { println!("hello"); }"# )
819
+ . symlink_dir ( "src" , "src1" )
820
+ . symlink_dir ( "src" , "src2" )
821
+ . symlink_dir ( "src" , "src3" )
822
+ . symlink_dir ( "src" , "src4" )
823
+ . file ( ".gitignore" , "/src1\n /src2/\n src3\n src4/" )
824
+ } ) ;
825
+
826
+ p. cargo ( "package -l --no-metadata" )
827
+ . with_stderr ( "" )
828
+ . with_stdout (
829
+ "\
830
+ .cargo_vcs_info.json
831
+ .gitignore
832
+ Cargo.lock
833
+ Cargo.toml
834
+ Cargo.toml.orig
835
+ src/main.rs
836
+ " ,
837
+ )
838
+ . run ( ) ;
839
+ }
840
+
841
+ #[ cargo_test]
842
+ #[ cfg( not( windows) ) ] // https://github.com/libgit2/libgit2/issues/6250
843
+ /// Test that /dir and /dir/ matches symlinks to directories in dirty working directory.
844
+ fn gitignore_symlink_dir_dirty ( ) {
845
+ if !symlink_supported ( ) {
846
+ return ;
847
+ }
848
+
849
+ let ( p, _repo) = git:: new_repo ( "foo" , |p| {
850
+ p. file ( "src/main.rs" , r#"fn main() { println!("hello"); }"# )
851
+ . file ( ".gitignore" , "/src1\n /src2/\n src3\n src4/" )
852
+ } ) ;
853
+
854
+ p. symlink ( "src" , "src1" ) ;
855
+ p. symlink ( "src" , "src2" ) ;
856
+ p. symlink ( "src" , "src3" ) ;
857
+ p. symlink ( "src" , "src4" ) ;
858
+
859
+ p. cargo ( "package -l --no-metadata" )
860
+ . with_stderr ( "" )
861
+ . with_stdout (
862
+ "\
863
+ .cargo_vcs_info.json
864
+ .gitignore
865
+ Cargo.lock
866
+ Cargo.toml
867
+ Cargo.toml.orig
868
+ src/main.rs
869
+ " ,
870
+ )
871
+ . run ( ) ;
872
+
873
+ p. cargo ( "package -l --no-metadata --allow-dirty" )
874
+ . with_stderr ( "" )
875
+ . with_stdout (
876
+ "\
877
+ .gitignore
878
+ Cargo.lock
879
+ Cargo.toml
880
+ Cargo.toml.orig
881
+ src/main.rs
882
+ " ,
883
+ )
884
+ . run ( ) ;
885
+ }
886
+
809
887
#[ cargo_test]
810
888
/// Tests if a symlink to a directory is properly included.
811
889
///
0 commit comments