File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -79,3 +79,43 @@ fn test_run_silent_failures() -> eyre::Result<()> {
79
79
80
80
Ok ( ( ) )
81
81
}
82
+
83
+ // Creating symlinks on Windows may fail without administrator or developer
84
+ // privileges, so this test is Unix only. See
85
+ // https://doc.rust-lang.org/std/os/windows/fs/fn.symlink_dir.html#limitations
86
+ // for more details.
87
+ #[ cfg( unix) ]
88
+ #[ test]
89
+ fn test_run_in_repo_tool_project ( ) -> eyre:: Result < ( ) > {
90
+ use std:: { fs, os:: unix} ;
91
+
92
+ let git = make_git ( ) ?;
93
+ git. init_repo ( ) ?;
94
+
95
+ let git_dir = git. repo_path . join ( ".git" ) ;
96
+ let repo_managed_dir = tempfile:: tempdir ( ) ?;
97
+ let repo_managed_git_dir = repo_managed_dir. path ( ) . join ( ".repo/test_repo" ) ;
98
+ fs:: create_dir_all ( & repo_managed_git_dir) ?;
99
+ fs:: rename ( & git_dir, & repo_managed_git_dir) ?;
100
+
101
+ unix:: fs:: symlink ( repo_managed_git_dir, git_dir) ?;
102
+
103
+ let git_run_info = GitRunInfo {
104
+ path_to_git : git. path_to_git . clone ( ) ,
105
+ working_directory : git. repo_path . clone ( ) ,
106
+ env : Default :: default ( ) ,
107
+ } ;
108
+
109
+ let result = git_run_info. run_silent (
110
+ & git. get_repo ( ) ?,
111
+ None ,
112
+ & [ "status" ] ,
113
+ GitRunOpts {
114
+ treat_git_failure_as_error : true ,
115
+ stdin : None ,
116
+ } ,
117
+ ) ;
118
+ assert ! ( result. is_ok( ) ) ;
119
+
120
+ Ok ( ( ) )
121
+ }
You can’t perform that action at this time.
0 commit comments