@@ -331,7 +331,8 @@ static int checkout_path(unsigned mode, struct object_id *oid,
331331}
332332
333333static 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 )
335336{
336337 char tmpdir [PATH_MAX ];
337338 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,
352353 struct index_state wtindex ;
353354 struct checkout lstate , rstate ;
354355 int rc , flags = RUN_GIT_CMD , err = 0 ;
355- struct child_process child = CHILD_PROCESS_INIT ;
356356 const char * helper_argv [] = { "difftool--helper" , NULL , NULL , NULL };
357357 struct hashmap wt_modified , tmp_modified ;
358358 int indices_loaded = 0 ;
@@ -387,19 +387,19 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
387387 rdir_len = rdir .len ;
388388 wtdir_len = wtdir .len ;
389389
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" ,
397397 NULL );
398398 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 ))
401401 die ("could not obtain raw diff" );
402- fp = xfdopen (child . out , "r" );
402+ fp = xfdopen (child -> out , "r" );
403403
404404 /* Build index info for left and right sides of the diff */
405405 i = 0 ;
@@ -525,7 +525,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
525525
526526 fclose (fp );
527527 fp = NULL ;
528- if (finish_command (& child )) {
528+ if (finish_command (child )) {
529529 ret = error ("error occurred running diff --raw" );
530530 goto finish ;
531531 }
@@ -719,6 +719,7 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
719719 OPT_ARGUMENT ("no-index" , & no_index , N_ ("passed to `diff`" )),
720720 OPT_END ()
721721 };
722+ struct child_process child = CHILD_PROCESS_INIT ;
722723
723724 git_config (difftool_config , NULL );
724725 symlinks = has_symlinks ;
@@ -769,6 +770,6 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
769770 * each file that changed.
770771 */
771772 if (dir_diff )
772- return run_dir_diff (extcmd , symlinks , prefix , argc , argv );
773+ return run_dir_diff (extcmd , symlinks , prefix , argc , argv , & child );
773774 return run_file_diff (prompt , prefix , argc , argv );
774775}
0 commit comments