{"thread":{"id":"57707","subject":"Issue when using the fsmonitor-watchman hook?","startedAt":"2022-04-10T18:21:35Z","lastAt":"2022-04-12T19:27:17Z","messageCount":3,"participants":["Kaartic Sivaraam","Derrick Stolee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"453387","messageId":"3ce82619-6305-69b6-b4e5-bbbc91c17530@gmail.com","threadId":"57707","inReplyTo":null,"subject":"Issue when using the fsmonitor-watchman hook?","fromName":"Kaartic Sivaraam","fromEmail":"kaartic.sivaraam@gmail.com","sentAt":"2022-04-10T18:21:28Z","receivedAt":"2022-04-10T18:21:35Z","isPatch":false,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"Hi all,\n\nI recently installed v2.36.0-rc1 and started getting the warning about\nthe deprecation of core.useBuiltinFSMonitor configuration. It appeared\nfor each 'git' invocation which was a bit annoying. Fortunately, I had\nsome spare time so I went the route of actually applying the suggested\nalternative rather than suppressing the warning.\n\nAccording to the git-hooks documentation, I configured core.fsmonitor\nto '.git/hooks/fsmonitor-watchman' and after that for some reason all\nthe styles in the terminal seems to have gone awry (I use Windows\nTerminal with PowerShell 7). A sample demonstration.\n\nThis is how the terminal should've looked (it appears with appropriate \ncolours):\n\n   04-10 23:36:38 D:\\Source\\kaartic\\git [(f2817c1...) +2 ~0 -0 !]\n >\n\nAfter setting the config the following is how it got rendered (without \ncolours):\n\n←[95m04-10 23:36:20 ←[0mD:\\Source\\kaartic\\the-wallet \n←[93m[←[0m←[96mmaster←[0m←[96m ≡←[0m←[31m←[49m +1←[0m←[31m←[49m \n~0←[0m←[31m←[49m -0←[0m←[31m !←[0m←[93m]←[0m\n > cd ..\\git\\\n\nI should note that I use posh-git [2] plug-in for the colourized\nGit metadata info in the terminal.\n\nAlso, I got the following error messages when running 'git status'\n\n > git status\nopen2: exec of watchman -j --no-pretty failed: No such file or directory \nat .git/hooks/fsmonitor-watchman line 78.\nUnsupported query-fsmonitor hook version '1'.\nFalling back to scanning...\nOn branch master\nYour branch is up to date with 'origin/master'.\n\n...\n\n\nIt's clear that I'm doing something wrong. I'm not sure what, though.\nThe fact that I have no clear idea about what the fsmonitor-watchman\nhook does, does not help at all. It would be great if someone could\nhelp me understand what I got wrong :)\n\n\n[1]: https://git-scm.com/docs/githooks#_fsmonitor_watchman\n[2]: https://github.com/dahlbyk/posh-git\n\n-- \nSivaraam\n"},{"id":"453410","messageId":"edea2223-a9e1-c026-089f-80ea36cf97c2@github.com","threadId":"57707","inReplyTo":"3ce82619-6305-69b6-b4e5-bbbc91c17530@gmail.com","subject":"Re: Issue when using the fsmonitor-watchman hook?","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-04-11T13:46:24Z","receivedAt":"2022-04-11T13:47:04Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 4/10/2022 2:21 PM, Kaartic Sivaraam wrote:\n> Hi all,\n\nHi Kaartic,\n \n> I recently installed v2.36.0-rc1 and started getting the warning about\n> the deprecation of core.useBuiltinFSMonitor configuration. It appeared\n> for each 'git' invocation which was a bit annoying. Fortunately, I had\n> some spare time so I went the route of actually applying the suggested\n> alternative rather than suppressing the warning.\n\nSo, the new alternative is to set core.fsmonitor=true, which continues\nto use the builtin FS Monitor. What advice did you see that was\ndifferent?\n\n(Also, this thread will only apply to Git for Windows, since core Git\ndid not include core.useBuiltinFSMonitor. Feel free to move this\ndiscussion to [1] if you'd rather talk there.)\n\n[1] https://github.com/git-for-windows/git/discussions/3251\n\nHopefully using core.fsmonitor=true solves your issue.\n\n---\n\nIf you really want to use the Watchman-based hook solution, then\nhere's the rest of my response:\n\n> According to the git-hooks documentation, I configured core.fsmonitor\n> to '.git/hooks/fsmonitor-watchman' and after that for some reason all\n> the styles in the terminal seems to have gone awry (I use Windows\n> Terminal with PowerShell 7). A sample demonstration.\n\nThe hooks documentation will only discuss the external hook-based\nFS Monitor, not the builtin one, so you are changing your behavior\nhere.\n> Also, I got the following error messages when running 'git status'\n> \n>> git status\n> open2: exec of watchman -j --no-pretty failed: No such file or directory at .git/hooks/fsmonitor-watchman line 78.\n\n> It's clear that I'm doing something wrong. I'm not sure what, though.\n> The fact that I have no clear idea about what the fsmonitor-watchman\n> hook does, does not help at all. It would be great if someone could\n> help me understand what I got wrong :)\n\nThe .git/hooks/ directory is populated when your repository is\ncreated. That hook might not have existed in your installed templates\nwhen your repo was initialized.\n\nFurther, the default name is \"fsmonitor-watchman.sample\" and you need\nto change the name (after inspecting the script to ensure it is not\nmalicious). You can also find the latest copy in a more protected\nplace: C:\\Program Files\\Git\\mingw64\\share\\git-core\\templates\\hooks\n\nThe .NET version of Scalar used to update the hook from this\nprotected directory on upgrade. With the builtin mechanism, such\nefforts are not necessary.\n\nThanks,\n-Stolee\n"},{"id":"453460","messageId":"f939ebd9-b801-0961-ffad-b87c94096f5d@gmail.com","threadId":"57707","inReplyTo":"edea2223-a9e1-c026-089f-80ea36cf97c2@github.com","subject":"Re: Issue when using the fsmonitor-watchman hook?","fromName":"Kaartic Sivaraam","fromEmail":"kaartic.sivaraam@gmail.com","sentAt":"2022-04-12T19:27:02Z","receivedAt":"2022-04-12T19:27:17Z","isPatch":false,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"Hi Stolee,\n\nOn 11/04/22 19:16, Derrick Stolee wrote:\n>   \n>> I recently installed v2.36.0-rc1 and started getting the warning about\n>> the deprecation of core.useBuiltinFSMonitor configuration. It appeared\n>> for each 'git' invocation which was a bit annoying. Fortunately, I had\n>> some spare time so I went the route of actually applying the suggested\n>> alternative rather than suppressing the warning.\n> \n> So, the new alternative is to set core.fsmonitor=true, which continues\n> to use the builtin FS Monitor. What advice did you see that was\n> different?\n> \n\nAh ha. I should've guessed that. The actual advice I saw was the following:\n\n   hint: core.useBuiltinFSMonitor will be deprecated soon; use \ncore.fsmonitor instead\n   hint: Disable this message with \"git config \nadvice.useCoreFSMonitorConfig false\"\n\nRather than trying out configuring 'core.fsmonitor' to 'true', I went\nand took a look at the documentation for it in git-config [doc] which\nread as follows:\n\n   If set, the value of this variable is used as a command which will\n   identify all files that may have changed since the requested\n   date/time.\n\nThat made me think the value could only be a command. So, it never\noccurred to me that it could be a boolean. I just checked the local\ndoc that shows up when running `git config --help` in Windows and that\nseems to clearly mention the behaviour that setting to `true` would\nenable the built-in file system monitor. Looks like I made a mistake\nand referred to the doc for v2.35.2 when trying out the v2.36.0-rc2 x-<\n\n[doc]: \nhttps://git-scm.com/docs/git-config#Documentation/git-config.txt-corefsmonitor\n\n> (Also, this thread will only apply to Git for Windows, since core Git\n> did not include core.useBuiltinFSMonitor. Feel free to move this\n> discussion to [1] if you'd rather talk there.)\n> \n> [1] https://github.com/git-for-windows/git/discussions/3251\n> \n> Hopefully using core.fsmonitor=true solves your issue.\n>\n\nYeah. That works fine and suppresses the warning properly. Thanks!\n\n> \n> If you really want to use the Watchman-based hook solution, then\n> here's the rest of my response:\n>\n > ...\n\nI do wish to try out Watchman but not right now. For now, I suppose\nI'm fine with whatever the builtin fsmonitor does. Anyways, thanks\nfor the details!\n\n\n-- \nSivaraam\n"}]}