git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>
Subject: Re: [PATCH] date: remove approxidate_relative()
Date: Mon, 10 Apr 2023 14:05:45 -0700	[thread overview]
Message-ID: <xmqqy1mzcus6.fsf@gitster.g> (raw)
In-Reply-To: <20230410202536.GE104097@coredump.intra.peff.net> (Jeff King's message of "Mon, 10 Apr 2023 16:25:36 -0400")

Jeff King <peff@peff.net> writes:

> 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.

"-U16" extends the context lines in both directions by the same
number of lines, but most likely you need to extend asymmetrically.
In René's patch, for example, much of the body of approxidate_str()
is visible in the precontext of the hunk to remove
approxidate_relative(), but the body of that function is irrelevant.
What he wanted to show was the body of approxidate_careful() and the
size of that function is where the -U16 came from.

Instead, imagine --extra-context='<range>:<path>' were the way to
tell Git to include the specified range of lines in the post context
even though they may not have been modified.  Then René's patch
could have been produced with

    $ git format-patch -1 \
      --extra-context='/^timestamp_t approxidate_careful/,/^}$/:date.c'

and would have shown 3 lines of precontext before the removed
approxidate_relative(), plus the unchanged approxidate_careful()
function in full in the postcontext.

  parent reply	other threads:[~2023-04-10 21:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  9:35 [PATCH] date: remove approxidate_relative() René Scharfe
2023-04-10 16:20 ` Junio C Hamano
2023-04-10 20:25   ` Jeff King
2023-04-10 20:52     ` René Scharfe
2023-04-11  9:25       ` Jeff King
2023-04-10 21:05     ` Junio C Hamano [this message]
2023-04-11  9:30       ` Jeff King
2023-04-11 15:43         ` Junio C Hamano
2023-04-12  7:30           ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy1mzcus6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).