@@ -187,6 +187,35 @@ void test_core_filebuf__symlink_follow(void)
187187 cl_git_pass (git_futils_rmdir_r (dir , NULL , GIT_RMDIR_REMOVE_FILES ));
188188}
189189
190+ void test_core_filebuf__symlink_follow_absolute_paths (void )
191+ {
192+ git_filebuf file = GIT_FILEBUF_INIT ;
193+ git_buf source = GIT_BUF_INIT , target = GIT_BUF_INIT ;
194+
195+ #ifdef GIT_WIN32
196+ cl_skip ();
197+ #endif
198+
199+ cl_git_pass (git_buf_joinpath (& source , clar_sandbox_path (), "linkdir/link" ));
200+ cl_git_pass (git_buf_joinpath (& target , clar_sandbox_path (), "linkdir/target" ));
201+ cl_git_pass (p_mkdir ("linkdir" , 0777 ));
202+ cl_git_pass (p_symlink (target .ptr , source .ptr ));
203+
204+ cl_git_pass (git_filebuf_open (& file , source .ptr , 0 , 0666 ));
205+ cl_git_pass (git_filebuf_printf (& file , "%s\n" , "libgit2 rocks" ));
206+
207+ cl_assert_equal_i (true, git_path_exists ("linkdir/target.lock" ));
208+
209+ cl_git_pass (git_filebuf_commit (& file ));
210+ cl_assert_equal_i (true, git_path_exists ("linkdir/target" ));
211+
212+ git_filebuf_cleanup (& file );
213+ git_buf_free (& source );
214+ git_buf_free (& target );
215+
216+ cl_git_pass (git_futils_rmdir_r ("linkdir" , NULL , GIT_RMDIR_REMOVE_FILES ));
217+ }
218+
190219void test_core_filebuf__symlink_depth (void )
191220{
192221 git_filebuf file = GIT_FILEBUF_INIT ;
0 commit comments