File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -124,3 +124,30 @@ void test_core_filebuf__umask(void)
124
124
cl_must_pass (p_unlink (test ));
125
125
}
126
126
127
+ void test_core_filebuf__rename_error (void )
128
+ {
129
+ git_filebuf file = GIT_FILEBUF_INIT ;
130
+ char * dir = "subdir" , * test = "subdir/test" , * test_lock = "subdir/test.lock" ;
131
+ int fd ;
132
+
133
+ #ifndef GIT_WIN32
134
+ cl_skip ();
135
+ #endif
136
+
137
+ cl_git_pass (p_mkdir (dir , 0666 ));
138
+ cl_git_mkfile (test , "dummy content" );
139
+ fd = p_open (test , O_RDONLY );
140
+ cl_assert (fd > 0 );
141
+ cl_git_pass (git_filebuf_open (& file , test , 0 , 0666 ));
142
+
143
+ cl_git_pass (git_filebuf_printf (& file , "%s\n" , "libgit2 rocks" ));
144
+
145
+ cl_assert_equal_i (true, git_path_exists (test_lock ));
146
+
147
+ cl_git_fail (git_filebuf_commit (& file ));
148
+ p_close (fd );
149
+
150
+ git_filebuf_cleanup (& file );
151
+ cl_assert_equal_i (false, git_path_exists (test_lock ));
152
+
153
+ }
You can’t perform that action at this time.
0 commit comments