A local-first personal finance app
[AI] Improve post-checkout hook to handle git worktree creation (#7393)
Matiss Janis Aboltins799db6c49617
diff --git a/.husky/post-checkout b/.husky/post-checkoutindex b72113be3f..697964df72 100755--- a/.husky/post-checkout+++ b/.husky/post-checkout@@ -1,11 +1,19 @@#!/bin/sh# Run yarn install when switching branches (if yarn.lock changed)+# or when creating a new worktree (node_modules won't exist yet)# $3 is 1 for branch checkout, 0 for file checkoutif [ "$3" != "1" ]; thenexit 0fi+# Worktree creation: node_modules doesn't exist yet, always install+if [ ! -d "node_modules" ]; then+ echo "New worktree detected — running yarn install..."+ yarn install || exit 1+ exit 0+fi+# Check if yarn.lock changed between the old and new HEADif git diff --name-only "$1" "$2" | grep -q "^yarn.lock$"; thenecho "yarn.lock changed — running yarn install..."diff --git a/upcoming-release-notes/7393.md b/upcoming-release-notes/7393.mdnew file mode 100644index 0000000000..da61a8d26e--- /dev/null+++ b/upcoming-release-notes/7393.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MatissJanis]+---++Improve post-checkout hook to automatically install dependencies for newly created git worktrees.