@@ -15,7 +15,9 @@ static git_buf expected_fixture = GIT_BUF_INIT;
1515
1616static int unlink_file (void * payload , git_buf * path )
1717{
18- const char * fn = git_path_basename (path -> ptr );
18+ char * fn ;
19+
20+ cl_assert (fn = git_path_basename (path -> ptr ));
1921
2022 GIT_UNUSED (payload );
2123
@@ -36,7 +38,7 @@ void test_checkout_crlf__initialize(void)
3638 * remove the contents of the working directory so that we can
3739 * check out over it.
3840 */
39- git_buf_puts (& reponame , "crlf" );
41+ cl_git_pass ( git_buf_puts (& reponame , "crlf" ) );
4042 cl_git_pass (git_path_direach (& reponame , 0 , unlink_file , NULL ));
4143
4244 if (GIT_EOL_NATIVE == GIT_EOL_CRLF )
@@ -130,38 +132,38 @@ static void test_checkout(const char *autocrlf, const char *attrs)
130132 struct compare_data compare_data = { NULL , autocrlf , attrs };
131133 const char * c ;
132134
133- git_buf_puts (& reponame , "crlf" );
135+ cl_git_pass ( git_buf_puts (& reponame , "crlf" ) );
134136
135- git_buf_puts (& systype_and_direction , systype );
136- git_buf_puts (& systype_and_direction , "_to_workdir" );
137+ cl_git_pass ( git_buf_puts (& systype_and_direction , systype ) );
138+ cl_git_pass ( git_buf_puts (& systype_and_direction , "_to_workdir" ) );
137139
138- git_buf_puts (& sandboxname , "autocrlf_" );
139- git_buf_puts (& sandboxname , autocrlf );
140+ cl_git_pass ( git_buf_puts (& sandboxname , "autocrlf_" ) );
141+ cl_git_pass ( git_buf_puts (& sandboxname , autocrlf ) );
140142
141143 if (* attrs ) {
142- git_buf_puts (& sandboxname , "," );
144+ cl_git_pass ( git_buf_puts (& sandboxname , "," ) );
143145
144146 for (c = attrs ; * c ; c ++ ) {
145147 if (* c == ' ' )
146- git_buf_putc (& sandboxname , ',' );
148+ cl_git_pass ( git_buf_putc (& sandboxname , ',' ) );
147149 else if (* c == '=' )
148- git_buf_putc (& sandboxname , '_' );
150+ cl_git_pass ( git_buf_putc (& sandboxname , '_' ) );
149151 else
150- git_buf_putc (& sandboxname , * c );
152+ cl_git_pass ( git_buf_putc (& sandboxname , * c ) );
151153 }
152154
153- git_buf_printf (& attrbuf , "* %s\n" , attrs );
155+ cl_git_pass ( git_buf_printf (& attrbuf , "* %s\n" , attrs ) );
154156 cl_git_mkfile ("crlf/.gitattributes" , attrbuf .ptr );
155157 }
156158
157159 cl_repo_set_string (g_repo , "core.autocrlf" , autocrlf );
158160
159- git_buf_joinpath (& expected_dirname , systype_and_direction .ptr , sandboxname .ptr );
160- git_buf_joinpath (& expected_fixture , "crlf_data" , expected_dirname .ptr );
161+ cl_git_pass ( git_buf_joinpath (& expected_dirname , systype_and_direction .ptr , sandboxname .ptr ) );
162+ cl_git_pass ( git_buf_joinpath (& expected_fixture , "crlf_data" , expected_dirname .ptr ) );
161163 cl_fixture_sandbox (expected_fixture .ptr );
162164
163165 opts .checkout_strategy = GIT_CHECKOUT_FORCE ;
164- git_checkout_head (g_repo , & opts );
166+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
165167
166168 compare_data .dirname = sandboxname .ptr ;
167169 cl_git_pass (git_path_direach (& reponame , 0 , compare_file , & compare_data ));
@@ -180,19 +182,20 @@ static void test_checkout(const char *autocrlf, const char *attrs)
180182static void empty_workdir (const char * name )
181183{
182184 git_vector contents = GIT_VECTOR_INIT ;
185+ char * basename ;
186+ int cmp ;
183187 size_t i ;
184188 const char * fn ;
185189
186- git_path_dirload (& contents , name , 0 , 0 );
190+ cl_git_pass ( git_path_dirload (& contents , name , 0 , 0 ) );
187191 git_vector_foreach (& contents , i , fn ) {
188- char * basename = git_path_basename (fn );
189- int cmp = strncasecmp (basename , ".git" , 4 );
192+ cl_assert ( basename = git_path_basename (fn ) );
193+ cmp = strncasecmp (basename , ".git" , 4 );
190194
191195 git__free (basename );
192196
193- if (cmp == 0 )
194- continue ;
195- p_unlink (fn );
197+ if (cmp )
198+ cl_git_pass (p_unlink (fn ));
196199 }
197200 git_vector_free_deep (& contents );
198201}
@@ -364,7 +367,7 @@ void test_checkout_crlf__with_ident(void)
364367 p_unlink ("crlf/more1.identlf" );
365368 p_unlink ("crlf/more2.identcrlf" );
366369
367- git_checkout_head (g_repo , & opts );
370+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
368371
369372 cl_assert_equal_file (
370373 ALL_LF_TEXT_AS_CRLF
@@ -393,7 +396,7 @@ void test_checkout_crlf__autocrlf_false_no_attrs(void)
393396
394397 cl_repo_set_bool (g_repo , "core.autocrlf" , false);
395398
396- git_checkout_head (g_repo , & opts );
399+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
397400
398401 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_RAW );
399402 check_file_contents ("./crlf/all-crlf" , ALL_CRLF_TEXT_RAW );
@@ -406,7 +409,7 @@ void test_checkout_crlf__autocrlf_true_no_attrs(void)
406409
407410 cl_repo_set_bool (g_repo , "core.autocrlf" , true);
408411
409- git_checkout_head (g_repo , & opts );
412+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
410413
411414 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_AS_CRLF );
412415 check_file_contents ("./crlf/all-crlf" , ALL_CRLF_TEXT_AS_CRLF );
@@ -419,7 +422,7 @@ void test_checkout_crlf__autocrlf_input_no_attrs(void)
419422
420423 cl_repo_set_string (g_repo , "core.autocrlf" , "input" );
421424
422- git_checkout_head (g_repo , & opts );
425+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
423426
424427 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_RAW );
425428 check_file_contents ("./crlf/all-crlf" , ALL_CRLF_TEXT_RAW );
@@ -434,7 +437,7 @@ void test_checkout_crlf__autocrlf_false_text_auto_attr(void)
434437
435438 cl_repo_set_bool (g_repo , "core.autocrlf" , false);
436439
437- git_checkout_head (g_repo , & opts );
440+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
438441
439442 if (GIT_EOL_NATIVE == GIT_EOL_CRLF ) {
440443 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_AS_CRLF );
@@ -454,7 +457,7 @@ void test_checkout_crlf__autocrlf_true_text_auto_attr(void)
454457
455458 cl_repo_set_bool (g_repo , "core.autocrlf" , true);
456459
457- git_checkout_head (g_repo , & opts );
460+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
458461
459462 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_AS_CRLF );
460463 check_file_contents ("./crlf/all-crlf" , ALL_CRLF_TEXT_AS_CRLF );
@@ -469,7 +472,7 @@ void test_checkout_crlf__autocrlf_input_text_auto_attr(void)
469472
470473 cl_repo_set_string (g_repo , "core.autocrlf" , "input" );
471474
472- git_checkout_head (g_repo , & opts );
475+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
473476
474477 check_file_contents ("./crlf/all-lf" , ALL_LF_TEXT_RAW );
475478 check_file_contents ("./crlf/all-crlf" , ALL_CRLF_TEXT_RAW );
@@ -482,8 +485,8 @@ void test_checkout_crlf__can_write_empty_file(void)
482485
483486 cl_repo_set_bool (g_repo , "core.autocrlf" , true);
484487
485- git_repository_set_head (g_repo , "refs/heads/empty-files" );
486- git_checkout_head (g_repo , & opts );
488+ cl_git_pass ( git_repository_set_head (g_repo , "refs/heads/empty-files" ) );
489+ cl_git_pass ( git_checkout_head (g_repo , & opts ) );
487490
488491 check_file_contents ("./crlf/test1.txt" , "" );
489492
0 commit comments