Re: [PATCH v3 0/4] Better support for customising context lines in --patch commands
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 9, 2025, 00:09 UTC
- Message-ID
- <xmqqms9eql73.fsf@gitster.g>
- In-Reply-To
- <pull.1915.v3.git.1751128486.gitgitgadget@gmail.com>
"Leon Michalak via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 52 quoted lines
> This series of patches attempt to give --interactive/--patch compatible
> builtins ("add", "commit", "checkout", "reset", "restore" and "stash")
> better support and nicer experience for configuring how many context lines
> are shown in diffs through a variety of ways.
>
> Prior to these patches, the user could not choose how many context lines
> they saw in --patch commands (apart from one workaround by using
> GIT_DIFF_OPTS=-u<number> ..., however this isn't a good user experience or a
> persistent solution). Additionally, the behaviour around reading from the
> diff.context and diff.interHunkContext configs was also inconsistent with
> other diff generating commands such as "log -p".
>
> The summarised changes below hopefully make this experience better and fix
> some inconsistencies:
>
> * diff.context and diff.interHunkContext configs are now respected by
> --patch compatible commands
> * --unified and --inter-hunk-context command line options have been added
> to --patch compatible commands (which take prescendence over file
> configs)
> * "add" and "commit" in --interactive mode now expose a new "context"
> subcommand which configures the amount of context lines you wish to see
> in subsequent diffs generated from other subcommands such as "patch" or
> "diff"
>
> The original discussion for this can be read at:
>
> * https://lore.kernel.org/git/CAP9jKjGb-Rcr=RLJEzeFdtrekYM+qmHy+1T1fykU3n9cV4GhGw@mail.gmail.com/
>
> Changes since v1:
>
> * Update commit descriptions
> * Update tests to use the more modern and robust test_grep and test_config
> utils
> * Reword some documentation / user messages
> * Ensure each commit is atomic and builds/passes tests on it's own
> * Make new command line options DRY
> * Add tests for interhunk context interaction
> * Error if context config/command line options are negative
> * Drop previous last commit to do with new subcommand for --interactive
> add/commit. My motivations behind this patch series originally where
> quite simple, just for add-patch commands to respect context configs.
> This subcommand, after the discussion in v1, will require more thought
> and a larger implementation that what I had anticipated. I would prefer
> to leave this for another time as it's the least impactful but the most
> time intensive and complicated idea.
>
> Changes since v2:
>
> * Update tests to only test single command (following Philip's suggestion)
> * Add negative option checks
> * Minor commit re-wordingThis iteration seems to have attracted a few review comments that are left ananswered. Will we see responses to them, and/or, a hopefully small and final update sometime soon?
Thanks.