@@ -236,13 +236,11 @@ static int post_index_change_sentinel_exists(struct repository *r)
236
236
/**
237
237
* See if we can replace the requested hook with an internal behavior.
238
238
* Returns 0 if the real hook should run. Returns nonzero if we instead
239
- * executed custom internal behavior and the value to return is set to
240
- * 'result'.
239
+ * executed custom internal behavior and the real hook should not run.
241
240
*/
242
241
static int handle_hook_replacement (struct repository * r ,
243
242
const char * hook_name ,
244
- struct strvec * args ,
245
- int * result )
243
+ struct strvec * args )
246
244
{
247
245
const char * strval ;
248
246
if (repo_config_get_string_tmp (r , "postcommand.strategy" , & strval ) ||
@@ -252,17 +250,14 @@ static int handle_hook_replacement(struct repository *r,
252
250
if (!strcmp (hook_name , "post-index-change" )) {
253
251
/* Create a sentinel file only if the worktree changed. */
254
252
if (!strcmp (args -> v [0 ], "1" ))
255
- * result = write_post_index_change_sentinel (r );
256
- else
257
- * result = 0 ;
253
+ write_post_index_change_sentinel (r );
258
254
259
255
/* We don't skip post-index-change hooks that exist. */
260
256
return 0 ;
261
257
}
262
258
if (!strcmp (hook_name , "post-command" ) &&
263
259
!post_index_change_sentinel_exists (r )) {
264
260
/* We skip the post-command hook in this case. */
265
- * result = 0 ;
266
261
return 1 ;
267
262
}
268
263
@@ -295,12 +290,9 @@ int run_hooks_opt(struct repository *r, const char *hook_name,
295
290
};
296
291
297
292
/* Interject hook behavior depending on strategy. */
298
- if (r && r -> gitdir ) {
299
- int result = 0 ;
300
- if (handle_hook_replacement (r , hook_name ,
301
- & options -> args , & result ))
302
- return result ;
303
- }
293
+ if (r && r -> gitdir &&
294
+ handle_hook_replacement (r , hook_name , & options -> args ))
295
+ return 0 ;
304
296
305
297
hook_path = find_hook (r , hook_name );
306
298
0 commit comments