git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Boxuan Li <liboxuan@connect.hku.hk>,
	git@vger.kernel.org, gitster@pobox.com
Subject: Re: [RFC PATCH] userdiff: ship built-in driver config file
Date: Tue, 18 Jun 2019 23:49:29 -0400	[thread overview]
Message-ID: <20190619034929.GA515@sigill.intra.peff.net> (raw)
In-Reply-To: <488f215a-cb32-db3f-4a45-0062f0f0a0a9@kdbg.org>

On Tue, Jun 18, 2019 at 10:32:47PM +0200, Johannes Sixt wrote:

> Am 17.06.19 um 18:54 schrieb Boxuan Li:
> > The userdiff.c has been rewritten to avoid hard-coded built-in
> > driver patterns. Now we ship
> > $(sharedir)/git-core/templates/userdiff that can be read using
> > git_config_from_file() interface, using a very narrow callback
> > function that understands only diff.*.xfuncname,
> > diff.*.wordregex, and diff.*.regIcase.
> > 
> > Signed-off-by: Boxuan Li <liboxuan@connect.hku.hk>
> > ---
> > A few notes and questions:
> > 1. In [diff "tex"] section, \x80 and \xff cannot be parsed by git config parser.
> > I have no idea why this is happening. I changed them to \\x80 and \\xff as a workaround, which
> > resulted in t4034 failure (See https://travis-ci.org/li-boxuan/git/jobs/546729906#L4679).
> 
> I guess, the idea is to catch bytes of UTF-8 encoded characters as
> regular words.
> 
> The problem is to write such bytes literally into a git-config file and
> still keep the file editable in a portable. Perhaps it is necessary to
> declare the file as CP1252 encoded via .gitattributes, write that part
> of the regexp as [a-zA-Z0-9€-þ], and hope that your text editor writes
> the file acutally as CP1252. ISO8859-1 does not work because \x80 is not
> occupied.

We don't allow octal or hex escapes in config values, though we do allow
common C ones like "\n". Maybe we should support them.

I didn't check whether we actually want the raw bytes here ourselves,
though, or are happy making sure the backslashed forms make it into the
regex parser (it _seems_ like the latter would be what we want, but that
does mean escaping the backslashes so they make it through the config
parser literally).

> > diff --git a/templates/this--userdiff b/templates/this--userdiff
> > new file mode 100644
> > index 0000000000..85114a7229
> > --- /dev/null
> > +++ b/templates/this--userdiff
> 
> Why place this file in .git? To have per-repository diff drivers, we can
> already specify them via 'git config'. This file should be installed in
> the system.

I think it _could_ actually just be part of the system /etc/gitconfig,
though it is kind of big, and Git has a tendency to parse the config
more than necessary. I wonder if would add a noticeable slowdown.

-Peff

  parent reply	other threads:[~2019-06-19  3:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 16:54 [RFC PATCH] userdiff: ship built-in driver config file Boxuan Li
2019-06-18 20:32 ` Johannes Sixt
2019-06-18 20:50   ` Johannes Sixt
2019-06-19  3:49   ` Jeff King [this message]
2019-06-19  6:30     ` Johannes Sixt
2019-06-19 15:02       ` Junio C Hamano
2019-06-19 18:39       ` Jeff King
2019-06-20  7:41         ` Johannes Sixt
2019-06-19 14:50     ` Junio C Hamano
2019-06-19  3:58 ` Jeff King
2019-06-19 15:32   ` LI, BO XUAN
2019-06-19 18:42     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20190619034929.GA515@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=liboxuan@connect.hku.hk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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