git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] editorconfig: add Makefiles to "text files"

From
Max Gautier <mg@max.gautier.name>
Date
Mar 24, 2024, 07:54 UTC
Message-ID
<Zf_cSWY9DxVxKZu2@framework>
In-Reply-To
<xmqqr0g0yhoe.fsf@gitster.g>
On Sat, Mar 23, 2024 at 10:36:01AM -0700, Junio C Hamano wrote:
Show 35 quoted lines
> >>  * 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:
> 
> That is much less than ideal---I was hoping that we can do this
> with just one file.  My reading of that spec is that in the same
> file it would be the last one wins, so something line what I gave
> you above should work more-or-less as-is?
> 

I read it the same way, I didn't intend to imply using one top level only was not possible ; sorry for the lack of clarity.

Show 16 quoted lines
> Also I am not sure if there is any reason why ...
> 
> > - po/
> > - t/
> > - contrib/
> > - .github/
> > - ...
> >
> > Not sure if that's easier than adding stuff to the to the root config
> > though.
> 
> ... t/*.sh should use rules different from those that apply to
> check-builtins.sh at the root level, or contrib/mw-to-git/*.perl
> should use Perl rules different from those that apply to
> perl/Git.pm.  So I think "we need per-directory customization" is a
> red herring.

Oh, I was more thinking about the other stuff under t/ , not she scripts themselves, there is some .test, .diff, lots of files without extensions (some css apparently, among other stuff) , and without looking in details, my best guess is that most of this is test samples (=> I mean things used by the tests to compare / test processing result). I don't know if that's supposed to be edited manually though.

But yeah, "per-directory customization" isn't good, it multiplies the place to look when the config is not correct. I was mentioning by fear that using only one file would be hard to manage is there is too much patterns.

-- 
Max Gautier
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “editorconfig: add Makefiles to "text files"”
  1. editorconfig: add Makefiles to "text files"Max Gautier, Mar 22, 2024
  2. Junio C HamanoMar 22, 2024
  3. Max GautierMar 23, 2024
  4. Junio C HamanoMar 23, 2024
  5. Max GautierMar 24, 2024
  6. Junio C HamanoMar 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.