Skip to content

Commit 78a88a9

Browse files
authored
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)
1 parent a839cde commit 78a88a9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.githooks/post-commit

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/sh
22

3-
FILE=.links.disabled.yaml
3+
FILE=.links.temp-disabled.yaml
44
if test -f "$FILE"; then
5-
# echo "$FILE exists. -> moving to .links.disabled.yaml"
6-
mv .links.disabled.yaml .links.yaml
7-
# echo "running yarn"
5+
# Only do the post-commit hook if the file was temp-disabled by the pre-commit hook.
6+
# Otherwise linking was actively (`yarn links:disable`) disabled and this hook should noop.
7+
mv .links.temp-disabled.yaml .links.yaml
88
yarnLog=$(yarn)
99
echo "[yarn-linker] The post-commit hook has re-enabled .links.yaml."
1010
exit 1

.githooks/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
FILE=".links.yaml"
44
if test -f "$FILE"; then
5-
# echo "$FILE exists. -> moving to .links.disabled.yaml"
6-
mv .links.yaml .links.disabled.yaml
5+
mv .links.yaml .links.temp-disabled.yaml
76
# echo "running yarn"
87
x=$(yarn)
98
y=$(git add yarn.lock)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ yarn-error.log
2121
!/.yarn/versions
2222
/.links.yaml
2323
/.links.disabled.yaml
24+
/.links.temp-disabled.yaml
2425

2526
# Playwright
2627
/test-results/

0 commit comments

Comments
 (0)