Re: [PATCH] date: remove approxidate_relative()
- From
Jeff King <peff@peff.net>
- Date
- Apr 10, 2023, 20:25 UTC
- Message-ID
- <20230410202536.GE104097@coredump.intra.peff.net>
- In-Reply-To
- <xmqqjzyjemji.fsf@gitster.g>
On Mon, Apr 10, 2023 at 09:20:49AM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> Perhaps > > $ git -c format-patch.date.c.context=16 format-patch -1 > > would be a workable idea? I do not think it makes any sense to say > "when taking a diff for this path, always use 16 lines of context" > so it should not be stored in a file to be used every time, like > > [format-patch "date.c"] context = 16 > > and it makes even less sense to say that all project participants > should use this context, always, so making it an attribute would be > even less appropriate. > > But this was the easiest way to prototype ;-) If this turns out to > be useful, the real version should probably be done by:
Cute. It feels like this only goes half-way, though. You really want per-hunk configurable context. This particular patch was just lucky that there was only one hunk in the date.c file.
I'm not sure of the least-confusing way to address a single hunk, though (by line number is one option, by hunk-number within the patch is another). I suspect the best workflow for a user would be to interactively say "show me more context for this hunk". Some viewers have support for that (e.g., GitHub's web view of a diff). But handling that for a one-shot CLI program is tricky, not to mention then feeding it back to format-patch to generate the output you want to send. :)
-Peff