From: Max Gautier <mg@max.gautier.name>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Hans Jerry Illikainen <hji@dyntopia.com>
Subject: Re: [PATCH] editorconfig: add Makefiles to "text files"
Date: Sat, 23 Mar 2024 16:55:47 +0100 [thread overview]
Message-ID: <Zf77gyA28KsZdOUs@framework> (raw)
In-Reply-To: <xmqqo7b5zy84.fsf@gitster.g>
On Fri, Mar 22, 2024 at 03:40:59PM -0700, Junio C Hamano wrote:
> A question out of curiosity (because the answer does not affect any
> conclusion): Does editorconfig attempt to cover any non-text files?
Apparently they it does not differentiate binary files:
https://github.com/editorconfig/editorconfig-core-js/issues/42
https://github.com/editorconfig/editorconfig/issues/285#issuecomment-267400370
> Two more questions that do affect the conclusions are:
>
> * Among the files we ship (i.e. "git ls-tree -r HEAD") and edit
> with editors that honor .editorconfig settings, are there any
> file that we do not want tab indentation other than *.py?
$ git ls-tree -r HEAD | cut -f 2 | \
grep -vE '.*\.(c|h|sh|perl|pl|pm|txt)' | grep -v t/ \
| rev | cut -d . -f -1 | rev | sort | uniq -c | grep -vE '\<1\>'
-> gives for a first approximation (much more if not filtering unique
occurrences)
2 bash
2 el
8 gitattributes
15 gitignore
4 go
2 in
7 js -> git-gui + git-web
8 md
2 png
41 po
2 pot
14 sample
41 tcl -> git-gui
5 xsl
5 yml -> ci stuff
Not sure which one among those don't want the same tab-indent settings
though.
>
> * Does .editorconfig file allow possibly conflicting setting, with
> a reliable conflict resolution rules?
Yeah it does: https://spec.editorconfig.org/#id8
TL;DR:
- from top to bottom, last matching section wins
- if multiple .editorconfig are found (up until one with the root key or
in /) closest to the file wins.
>
> What I am trying to get at is if it is possible to make something
> along this line to work:
>
> [*]
> charset = utf-8
> insert_final_newline = true
> indent_style = tab
> tab_width = 8
> [*.py]
> indent_style = space
> indet_size = 4
>
> I am assuming, without knowing, that the conflict resolution rule
> may be "for the same setting, the last match wins" so by default we
> always use "indent_style = tab", but if we are talking about a Python
> script, it is overruled with "indent_style = space".
So it looks like it's possible, if we also add judiciously .editorconfig
in subdirectory where we have other files which don't want the same
settings, probably:
- po/
- t/
- contrib/
- .github/
- ...
Not sure if that's easier than adding stuff to the to the root config
though.
--
Max Gautier
next prev parent reply other threads:[~2024-03-23 15:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 22:17 [PATCH] editorconfig: add Makefiles to "text files" Max Gautier
2024-03-22 22:40 ` Junio C Hamano
2024-03-23 15:55 ` Max Gautier [this message]
2024-03-23 17:36 ` Junio C Hamano
2024-03-24 7:54 ` Max Gautier
2024-03-25 2:54 ` Junio C Hamano
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=Zf77gyA28KsZdOUs@framework \
--to=mg@max.gautier.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hji@dyntopia.com \
/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).