Re: [PATCH v2 1/2] rebase: remove completely useless -C option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 20, 2023, 12:05 UTC
- Message-ID
- <xmqq5yd1za0t.fsf@gitster.g>
- In-Reply-To
- <a0f8f5fac1c3f79cd46b943e95636728677dffef.1674190573.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 12 quoted lines
> From: Elijah Newren <newren@gmail.com>
>
> The `-C` option to rebase was introduced with 67dad687ad ("add -C[NUM]
> to git-am", 2007-02-08).
> ...
> As per the git-apply documentation for the `-C` option:
> Ensure at least <n> lines of surrounding context match...When fewer
> lines of surrounding context exist they all must match.
>
> The fact that format-patch was not passed a -U option to increase the
> number of context lines meant that there would still only be 3 lines of
> context to match on.I am afraid that this is only less than half true. Isn't the intended use of -C<num> similar to how "patch --fuzz" is used?
That is, even when a patch does not cleanly apply with full context in the incoming diff, by requiring *smaller* number of lines to match, the diff *could* be forced to apply with reduced precision?
My read of "even if context has changed a bit" in the log of that commit is exactly that. And for such a use case (which I think is the primary use case for the feature), you do not need to futz with the patch generation side at all.
commit 67dad687ad15d26d8e26f4d27874af0bc0965ce2 Author: Michael S. Tsirkin <mst@kernel.org> Date: Thu Feb 8 15:57:08 2007 +0200
add -C[NUM] to git-am
Add -C[NUM] to git-am and git-rebase so that patches can be applied even
if context has changed a bit.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Junio C Hamano <junkio@cox.net>