On Mon, May 5, 2025 at 5:18 AM Leon Michalak via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > This aims to teach relevant builtins (that take in `--patch`) to respect > the user's diff.context and diff.interHunkContext file configurations. > > Since these are both UI options and `--patch` is designed for the end user, > I believe this was previously just an inconsistency, which this patch hopes > to address. > > Signed-off-by: Leon Michalak <leonmichalak6@xxxxxxxxx> > --- > diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh > @@ -49,7 +49,53 @@ test_expect_success 'diff.context honored by "log"' ' > ! grep firstline output && > git config diff.context 8 && > git log -1 -p >output && > - grep "^ firstline" output > + grep "^ firstline" output && > + git config --unset diff.context > +' > + > +test_expect_success 'diff.context honored by "add"' ' > + git add -p >output && > + ! grep firstline output && > + git config diff.context 8 && > + git add -p >output && > + grep "^ firstline" output && > + git config --unset diff.context > +' Be aware that if any command in the &&-chain prior to `git config --unset` fails, then `git config --unset` itself will not be executed, hence the cleanup won't happen. The way to address this is to instead use `test_config` to configure the value since it will ensure that the value gets "unset" regardless of whether the test succeeds or fails: test_config diff.context 8 && The same comment applies to all the new tests.