threads / bug / 47899

Bug Report: git status triggers a file change event

Subject: Bug Report: git status triggers a file change event

## tl;dr

4 messages between Feb 22, 2018 and Feb 23, 2018.

replies: 3people: 4as markdown or json

Raining Chain· Feb 22, 2018, 03:29 UTC · lore
On Windows 10, git version 2.16.2.windows.1, running the command
git status
will trigger a file change event to file C:\myPath\.git  "Attributes changed."

This causes problems when using scripts that detect file changes such as tsc -w (Typescript compiler) and using softwares that regularly call git status such as VisualStudioCode.

Thanks.
Jonathan Nieder· Feb 22, 2018, 05:22 UTC · re: Raining Chain · lore

Re: Bug Report: git status triggers a file change event

+git-for-windows Hi,

Raining Chain wrote:
Show 11 quoted lines
> On Windows 10, git version 2.16.2.windows.1, running the command
>
> git status
>
> will trigger a file change event to file C:\myPath\.git  "Attributes changed."
>
> This causes problems when using scripts that detect file changes such
> as tsc -w (Typescript compiler) and using softwares that regularly
> call git status such as VisualStudioCode.
>
> Thanks.

Can you say more about how "tsc -w" reacts to the file change? Is there a way to tell it to exclude particular files from the files it watches?

Thanks, Jonathan

Stefan Beller· Feb 22, 2018, 18:18 UTC · re: Jonathan Nieder · lore

Re: Bug Report: git status triggers a file change event

On Wed, Feb 21, 2018 at 9:22 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 16 quoted lines
> +git-for-windows
> Hi,
>
> Raining Chain wrote:
>
>> On Windows 10, git version 2.16.2.windows.1, running the command
>>
>> git status
>>
>> will trigger a file change event to file C:\myPath\.git  "Attributes changed."
>>
>> This causes problems when using scripts that detect file changes such
>> as tsc -w (Typescript compiler) and using softwares that regularly
>> call git status such as VisualStudioCode.
>>
>> Thanks.

Does https://github.com/git/git/commit/27344d6a6c8056664966e11acf674e5da6dd7ee3 help?

Show 6 quoted lines
>
> Can you say more about how "tsc -w" reacts to the file change?  Is there
> a way to tell it to exclude particular files from the files it watches?
>
> Thanks,
> Jonathan
Johannes Schindelin· Feb 23, 2018, 12:18 UTC · re: Stefan Beller · lore

Re: Bug Report: git status triggers a file change event

Hi all,
On Thu, 22 Feb 2018, Stefan Beller wrote:
> On Wed, Feb 21, 2018 at 9:22 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> > +git-for-windows

First of all, this is clearly not a Windows-specific problem, as the index file *is* updated, and that is simply the same behavior as on Linux/macOS.

Show 8 quoted lines
> > Raining Chain wrote:
> >
> >> On Windows 10, git version 2.16.2.windows.1, running the command
> >>
> >> git status
> >>
> >> will trigger a file change event to file C:\myPath\.git  "Attributes
> >> changed."
Correct, because .git\index changed.
> >> This causes problems when using scripts that detect file changes such
> >> as tsc -w (Typescript compiler) and using softwares that regularly
> >> call git status such as VisualStudioCode.
Visual Studio Code most likely does not look at .git for worktree changes.

As to the Typescript compiler: it should only look for .ts files, I would be very surprised if it was confused by .git's filesystem attributes changing!

If tsw is still confused, try adding
	"exclude": [
	    ".git"
	]
to your tsconfig.json.

Ciao, Johannes

← back to recent threads