@@ -331,7 +331,8 @@ static int checkout_path(unsigned mode, struct object_id *oid,
331
331
}
332
332
333
333
static int run_dir_diff (const char * extcmd , int symlinks , const char * prefix ,
334
- int argc , const char * * argv )
334
+ int argc , const char * * argv ,
335
+ struct child_process * child )
335
336
{
336
337
char tmpdir [PATH_MAX ];
337
338
struct strbuf info = STRBUF_INIT , lpath = STRBUF_INIT ;
@@ -352,7 +353,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
352
353
struct index_state wtindex ;
353
354
struct checkout lstate , rstate ;
354
355
int rc , flags = RUN_GIT_CMD , err = 0 ;
355
- struct child_process child = CHILD_PROCESS_INIT ;
356
356
const char * helper_argv [] = { "difftool--helper" , NULL , NULL , NULL };
357
357
struct hashmap wt_modified , tmp_modified ;
358
358
int indices_loaded = 0 ;
@@ -387,19 +387,19 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
387
387
rdir_len = rdir .len ;
388
388
wtdir_len = wtdir .len ;
389
389
390
- child . no_stdin = 1 ;
391
- child . git_cmd = 1 ;
392
- child . use_shell = 0 ;
393
- child . clean_on_exit = 1 ;
394
- child . dir = prefix ;
395
- child . out = -1 ;
396
- strvec_pushl (& child . args , "diff" , "--raw" , "--no-abbrev" , "-z" ,
390
+ child -> no_stdin = 1 ;
391
+ child -> git_cmd = 1 ;
392
+ child -> use_shell = 0 ;
393
+ child -> clean_on_exit = 1 ;
394
+ child -> dir = prefix ;
395
+ child -> out = -1 ;
396
+ strvec_pushl (& child -> args , "diff" , "--raw" , "--no-abbrev" , "-z" ,
397
397
NULL );
398
398
for (i = 0 ; i < argc ; i ++ )
399
- strvec_push (& child . args , argv [i ]);
400
- if (start_command (& child ))
399
+ strvec_push (& child -> args , argv [i ]);
400
+ if (start_command (child ))
401
401
die ("could not obtain raw diff" );
402
- fp = xfdopen (child . out , "r" );
402
+ fp = xfdopen (child -> out , "r" );
403
403
404
404
/* Build index info for left and right sides of the diff */
405
405
i = 0 ;
@@ -525,7 +525,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
525
525
526
526
fclose (fp );
527
527
fp = NULL ;
528
- if (finish_command (& child )) {
528
+ if (finish_command (child )) {
529
529
ret = error ("error occurred running diff --raw" );
530
530
goto finish ;
531
531
}
@@ -719,6 +719,7 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
719
719
OPT_ARGUMENT ("no-index" , & no_index , N_ ("passed to `diff`" )),
720
720
OPT_END ()
721
721
};
722
+ struct child_process child = CHILD_PROCESS_INIT ;
722
723
723
724
git_config (difftool_config , NULL );
724
725
symlinks = has_symlinks ;
@@ -769,6 +770,6 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
769
770
* each file that changed.
770
771
*/
771
772
if (dir_diff )
772
- return run_dir_diff (extcmd , symlinks , prefix , argc , argv );
773
+ return run_dir_diff (extcmd , symlinks , prefix , argc , argv , & child );
773
774
return run_file_diff (prompt , prefix , argc , argv );
774
775
}
0 commit comments