Phillip Wood <phillip.wood123@xxxxxxxxx> writes: > Hi Leon > > On 10/05/2025 14:46, Leon Michalak via GitGitGadget wrote: >> From: Leon Michalak <leonmichalak6@xxxxxxxxx> >> Various builtins that use add-patch infrastructure do not respect >> the user's diff.context and diff.interHunkContext file configurations. > > We could expand this slightly by adding > > This is because the plumbing commands used by "git add -p" to generate > the diff do not read those config settings. Fix this by reading the > config before generating the patch and passing it along to the diff > command with the "-U" and "--inter-hunk-context" command-line options. > >> This patch fixes this inconsistency. >> Signed-off-by: Leon Michalak <leonmichalak6@xxxxxxxxx> >> --- > >> @@ -78,6 +82,19 @@ void init_add_i_state(struct add_i_state *s, struct repository *r) >> repo_config_get_string(r, "diff.algorithm", >> &s->interactive_diff_algorithm); >> + if (!repo_config_get_int(r, "diff.context", &context)) { >> + if (context < 0) >> + die(_("%s cannot be negative"), "diff.context"); >> + else >> + s->context = context; >> + }; >> + if (!repo_config_get_int(r, "diff.interHunkContext", &interhunkcontext)) { >> + if (interhunkcontext < 0) >> + die(_("%s cannot be negative"), "diff.interHunkContext"); >> + else >> + s->interhunkcontext = interhunkcontext; >> + }; > > Thanks for changing this. This iteration of the code changes looks good Lose the ';' (semicolon) after closing {brace}s. This is C; you do not need an empty statement after a {block}. Everything in your review I am very happy to see. Thanks for giving a great review.