Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
fix(husky): stage server files from worktree root in pre-commit hook (#41835)
## Summary - Pre-commit hook stages server files at the wrong path when committing from a linked git worktree, creating an orphan tree at the worktree root in addition to the correct entry. - Root cause: git invokes hooks with `GIT_DIR` set but `GIT_WORK_TREE` unset. After `pushd app/server`, `git add` falls back to treating cwd as the worktree root, so `xargs git add appsmith-interfaces/...` (with the `app/server/` prefix stripped) stages files at the wrong location. Only affects worktrees, not the main checkout. - Fix: run `mvn spotless:apply` in a subshell (so the script's cwd stays at worktree root), and stage with full `app/server/...` paths via the unchanged path list. Same behavior in the main checkout; correct behavior in worktrees. ## Reproduction In a linked worktree with a staged change under `app/server/`, the hook stages the file twice — once correctly and once at the worktree root without the `app/server/` prefix. Verified by simulating the hook env (`GIT_DIR` set, cwd at `app/server/`) and running the old vs new `git add` invocation; old path produces the duplicate orphan entry, new path produces only the correct entry. ## Test plan - [ ] Commit a server file change from a linked git worktree (`git worktree add ...`); confirm `git status` after commit shows no orphan entries at the worktree root. - [ ] Commit a server file change from the main checkout; confirm spotless still runs and re-staging works as before. - [ ] Commit a client-only change; confirm `lint-staged` still runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated internal code formatting automation to improve developer workflow efficiency. --- **Note:** This release contains no user-facing changes. The update addresses internal development tooling. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/appsmithorg/appsmith/pull/41835?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
W
Wyatt Walter committed
3d5deb5f4a715517ea116e099306748b60ecb72a
Parent: 51c5591
Committed by GitHub <noreply@github.com>
on 5/22/2026, 6:19:36 PM