From 78a88a9e0b3b824ff5cf856714a6e7bacd47072e Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Wed, 16 Apr 2025 19:39:08 +0200 Subject: [PATCH] Add a .links.temp-disabled.yaml state explicitly for when the pre-commit hook disabled the yaml file. otherwise we end up with a linked repo after every commit. (#3210) --- .githooks/post-commit | 8 ++++---- .githooks/pre-commit | 3 +-- .gitignore | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.githooks/post-commit b/.githooks/post-commit index 96e19a17..467799bd 100755 --- a/.githooks/post-commit +++ b/.githooks/post-commit @@ -1,10 +1,10 @@ #!/usr/bin/sh -FILE=.links.disabled.yaml +FILE=.links.temp-disabled.yaml if test -f "$FILE"; then - # echo "$FILE exists. -> moving to .links.disabled.yaml" - mv .links.disabled.yaml .links.yaml - # echo "running yarn" + # Only do the post-commit hook if the file was temp-disabled by the pre-commit hook. + # Otherwise linking was actively (`yarn links:disable`) disabled and this hook should noop. + mv .links.temp-disabled.yaml .links.yaml yarnLog=$(yarn) echo "[yarn-linker] The post-commit hook has re-enabled .links.yaml." exit 1 diff --git a/.githooks/pre-commit b/.githooks/pre-commit index f8098203..435d75f1 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -2,8 +2,7 @@ FILE=".links.yaml" if test -f "$FILE"; then - # echo "$FILE exists. -> moving to .links.disabled.yaml" - mv .links.yaml .links.disabled.yaml + mv .links.yaml .links.temp-disabled.yaml # echo "running yarn" x=$(yarn) y=$(git add yarn.lock) diff --git a/.gitignore b/.gitignore index cc594f8a..d15cee0b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ yarn-error.log !/.yarn/versions /.links.yaml /.links.disabled.yaml +/.links.temp-disabled.yaml # Playwright /test-results/