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

Re: [PATCH] Makefile(s): avoid recipe prefix in conditional statements

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2024, 23:28 UTC
Message-ID
<xmqqpluz5t9j.fsf@gitster.g>
In-Reply-To
<xmqqle5n8rcr.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Taylor Blau <me@ttaylorr.com> writes:
>
>> When a conditional word (ifeq, ifneq, ifdef, etc.) is preceded by one or
>> more tab characters, replace each tab character with 8 space characters
>> with the following:
>>
>>     find . -type f -not -path './.git/*' -name Makefile -or -name '*.mak' |
>>       xargs perl -i -pe '
>>         s/(\t+)(ifn?eq|ifn?def|else|endif)/" " x (length($1) * 8) . $2/ge unless /\\$/
>>       '
>
> Yuck, it means auto indenting Makefile and its pieces almost
> impossible X-<.  I'll take the patch as there is no way to revert
> the change to GNU make, though.

We'd need something like this on top. Our top-level .gitattributes defines the default whitespace rules with !indent-with-non-tab and enables indent-with-non-tab for specific file suffixes like .[ch], but git-gui/.gitattributes enforces indent-with-non-tab for all files.

Another thing with this series (and this follow-up) is if we want to start treating git-gui/ as just a subdirectory without no plan to feed our changes to the "upstream". I am actually OK with that, as the "upstream" we merge (with -Xsubtree merge strategy) from does not seem to be very active and responsive these days.

 git-gui/.gitattributes | 1 +
 1 file changed, 1 insertion(+)
diff --git c/git-gui/.gitattributes w/git-gui/.gitattributes
index 59cd41dbff..118d56cfbd 100644
--- c/git-gui/.gitattributes
+++ w/git-gui/.gitattributes
@@ -3,3 +3,4 @@
 git-gui.sh  encoding=UTF-8
 /po/*.po    encoding=UTF-8
 /GIT-VERSION-GEN eol=lf
+Makefile    whitespace=!indent,trail,space
Previous: Paul Smith
Message 13 of 13 in “Makefiles are broken as of GNU Make commit 07fcee35f058a876447c8a021f9eb1943f902534”
  1. Dario GjorgjevskiApr 8, 2024
  2. Makefile(s): avoid recipe prefix in conditional statementsTaylor Blau, Apr 8, 2024
  3. Junio C HamanoApr 8, 2024
  4. Paul SmithApr 8, 2024
  5. Junio C HamanoApr 8, 2024
  6. Paul SmithApr 9, 2024
  7. Junio C HamanoApr 8, 2024
  8. Paul SmithApr 9, 2024
  9. Junio C HamanoApr 9, 2024
  10. Jeff KingApr 9, 2024
  11. Jeff KingApr 9, 2024
  12. Paul SmithApr 9, 2024
  13. Junio C HamanoApr 8, 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.