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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2024, 22:40 UTC
Message-ID
<xmqqo7b5zy84.fsf@gitster.g>
In-Reply-To
<20240322221813.13019-1-mg@max.gautier.name>
Max Gautier <mg@max.gautier.name> writes:
Show 23 quoted lines
> The Makefile and makefile fragments use the same indent style than the
> rest of the code (with some inconsistencies).
>
> Add them to the relevant .editorconfig section to make life easier for
> editors and reviewers.
>
> Signed-off-by: Max Gautier <mg@max.gautier.name>
> ---
>  .editorconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/.editorconfig b/.editorconfig
> index f9d819623d..15d6cbeab1 100644
> --- a/.editorconfig
> +++ b/.editorconfig
> @@ -4,7 +4,7 @@ insert_final_newline = true
>  
>  # The settings for C (*.c and *.h) files are mirrored in .clang-format.  Keep
>  # them in sync.
> -[*.{c,h,sh,perl,pl,pm,txt}]
> +[{*.{c,h,sh,perl,pl,pm,txt},config.mak.*,Makefile}]
>  indent_style = tab
>  tab_width = 8

A question out of curiosity (because the answer does not affect any conclusion): Does editorconfig attempt to cover any non-text files?

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?
 * Does .editorconfig file allow possibly conflicting setting, with
   a reliable conflict resolution rules?

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

If that is possible, we do not have to keep adding "ah, files that match this pattern are also text", i.e., everything is text and indented by tab, unless specified otherwise.

Thanks.
Previous: Max GautierNext: Max Gautier
Message 2 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.