# Bug Report: git status triggers a file change event

4 messages from 2018-02-22 to 2018-02-23. Participants: Raining Chain, Jonathan Nieder, Stefan Beller, Johannes Schindelin.
Thread: https://gitlist.dev/t/47899

## Raining Chain, 2018-02-22 03:29

Subject: Bug Report: git status triggers a file change event
Message-ID: <CAPaSTm=Vhg+S0Cf7rkcvXKH1eaEbw5aGOfCmtU7K3D+1kc-pGg@mail.gmail.com>
URL: https://gitlist.dev/e/CAPaSTm%3DVhg%2BS0Cf7rkcvXKH1eaEbw5aGOfCmtU7K3D%2B1kc-pGg%40mail.gmail.com

```
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, 2018-02-22 05:22

Subject: Re: Bug Report: git status triggers a file change event
Message-ID: <20180222052227.GA133592@aiede.svl.corp.google.com>
URL: https://gitlist.dev/e/20180222052227.GA133592%40aiede.svl.corp.google.com
In-Reply-To: <CAPaSTm=Vhg+S0Cf7rkcvXKH1eaEbw5aGOfCmtU7K3D+1kc-pGg@mail.gmail.com>

```
+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.

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, 2018-02-22 18:18

Subject: Re: Bug Report: git status triggers a file change event
Message-ID: <CAGZ79kZBrG7uQ5KOrpdkkhzet7chJhxVsKjTnVMQTrSGFAMZhw@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZBrG7uQ5KOrpdkkhzet7chJhxVsKjTnVMQTrSGFAMZhw%40mail.gmail.com
In-Reply-To: <20180222052227.GA133592@aiede.svl.corp.google.com>

```
On Wed, Feb 21, 2018 at 9:22 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> +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?

>
> 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, 2018-02-23 12:18

Subject: Re: Bug Report: git status triggers a file change event
Message-ID: <nycvar.QRO.7.76.6.1802231315480.56@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1802231315480.56%40ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz
In-Reply-To: <CAGZ79kZBrG7uQ5KOrpdkkhzet7chJhxVsKjTnVMQTrSGFAMZhw@mail.gmail.com>

```
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.

> > 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

```
