All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: Perhaps we want {diff,log,format}.noprefix and friends?
Date: Wed, 18 May 2022 10:21:40 -0700	[thread overview]
Message-ID: <xmqqh75mwycb.fsf_-_@gitster.g> (raw)
In-Reply-To: <CAN3rvwBWBPLB+Pm14S5Nb9LOV6ajhT8qMbwi5bBm1pK_8AgN5g@mail.gmail.com> (Theodore Dubois's message of "Tue, 17 May 2022 10:02:36 -0700")

>>   git -c diff.noprefix=no format-patch ...
>>
>> to cancel the config. (If that config really does want to be on, that
>> is.)
>>
>> That said, something like
>>
>>   git am -p0 ...
>>
>> should help on the receiving side, by way of skipping fewer path
>> components when applying the patch.

While it is very reasonable for end-users to make the output of
their local "git diff" output to their taste by setting the
diff.noprefix and other configuration options in the diff.*
namespace, it is wrong to inflict such a personal preference on
other project participants by sending such a no-prefix patch via
"git format-patch", when the convention at the receiving project is
to use "git am -p1" to accept them.

We would need to tweak the configuration system so that we can more
easily introduce "format.noprefix" that overrides "diff.noprefix"
only when the command being run is "git format-patch", perhaps?  

As things stand, we could teach builtin/log.c::git_format_config()
about "format.noprefix" and make "git format-patch" pay attention to
that in addition to "diff.noprefix" fairly easily, but such an
approach poorly scales.  When a new configuration gets introduced in
diff.c::git_diff_ui_config(), builtin/log.c::git_format_config()
would also need to be updated.

I initially started writing this with "left over bits" mark, but it
seems it is a bit larger in scope than that.

I also noticed that some format.* configuration variables are parsed
in git_log_config(), not git_format_config(), so "git log" would end
up honoring format.pretty and format.subjectprefix, etc., which look
wrong but probably is way too late to "fix".



      reply	other threads:[~2022-05-18 17:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 22:08 [PATCH] getpriority: Only getpriority translation the priority values Theodore Dubois
2022-05-14 14:20 ` Alejandro Colomar
2022-05-14 14:37 ` Alejandro Colomar
2022-05-14 15:00   ` Alejandro Colomar
2022-05-14 18:43   ` Martin Ågren
2022-05-14 21:18     ` Alejandro Colomar
2022-05-17 17:02     ` Theodore Dubois
2022-05-18 17:21       ` Junio C Hamano [this message]

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=xmqqh75mwycb.fsf_-_@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.