From fee0717179758268ce30050b720482b2b252519b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sat, 16 Jul 2022 11:12:41 +0200 Subject: [PATCH] Makefile: on Windows, run unix2dos on generated files The generators always produce UNIX line-ends. This creates false file modifications with Git on Windows. Convert them to DOS line-ends to avoid this. This was already done for the Go code; this commit just copies the approach to the Python and JavaScript generators. --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 94e6a10e..cac3ba70 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,11 @@ generate-py: # The generator outputs files so that we can write our own tests. We don't, # though, so it's better to just remove those placeholders. rm -rf addon/flamenco/manager/test +# The generators always produce UNIX line-ends. This creates false file +# modifications with Git. Convert them to DOS line-ends to avoid this. +ifeq ($(OS),Windows_NT) + git status --porcelain | grep '^ M addon/flamenco/manager' | cut -d' ' -f3 | xargs unix2dos --keepdate +endif generate-js: # The generator doesn't consistently overwrite existing files, nor does it @@ -134,6 +139,11 @@ generate-js: # which is listed in our `. mv web/_tmp-manager-api-javascript/src web/app/src/manager-api rm -rf web/_tmp-manager-api-javascript +# The generators always produce UNIX line-ends. This creates false file +# modifications with Git. Convert them to DOS line-ends to avoid this. +ifeq ($(OS),Windows_NT) + git status --porcelain | grep '^ M web/app/src/manager-api' | cut -d' ' -f3 | xargs unix2dos --keepdate +endif version: @echo "OS : ${OS}"