list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
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: <> (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:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2022-05-14 14:37 ` [PATCH] getpriority: Only getpriority translation the priority values 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:

  List information:

* 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 \ \ \

* 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.
Code repositories for project(s) associated with this inbox:

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 read-only IMAP folder(s) and NNTP newsgroup(s).