Skip to content

watch mode not working with git worktree #548

Done

Description

@monkoninja

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.0.0

Plugin version

No response

Node.js version

16.17.0

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

Description

At #547, I mistakenly assumed that watch mode was not working because of esm, in fact, watch mode is not working if the project is in the git worktree.
If you use typescript, then typescript rebuilds the project, but the server still does not restart.

Steps to Reproduce

git clone https://github.com/railwayapp-templates/fastify --bare
cd fastify.git
git worktree add main
cd main
npm i
npm run dev

change any file -> typescript rebuild -> server does not restart

Expected Behavior

No response

Activity

  1. mcollina commented on Sep 7, 2022

    @mcollina
    Member

    What's special with worktree that breaks this? We just use normal OS file watching.

  2. monkoninja commented on Sep 9, 2022

    @monkoninja
    Author

    I'm not sure what the problem is, so far I'm using nodemon. It works with worktree.

  3. added
    bug
    help wanted
    on Sep 9, 2022
  4. nooreldeenmansour commented on Sep 19, 2022

    @nooreldeenmansour
    Contributor

    I couldn't reproduce this on my end, I followed the steps you listed.

    My environment:

    • OS → Windows 10 (21H1)
    • Node Version → 16.17.0
    • Fastify-CLI Version → 5.4.2
  5. Eomm commented on Sep 24, 2022

    @Eomm
    Member

    I think the source of the issue starts from here:
    nodejs/node#36005

    and leads to the chokidar module's funding

    If we drop that module, we should go for the node:fs.watch one

  6. Tony133 commented on Nov 26, 2026

    @Tony133
    Member

    This should be fixed by #938: the default .git ignore was matching any path containing .git, including bare-clone directories such as repo.git/main, so the watcher ignored the whole project. Default ignores now match whole path segments only.

    Closing, but feel free to reopen if you still see the problem after the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions