0

Context:

We have a Visual Studio project that depends on a nuget package (A Visual Studio thing).

We upgrade our project with that nuget package every time we release a new version of that package.

The project is stored in git and we clone the project to get a local copy so we can start the upgrade from Visual Studio itself through nuget updates.

A colleague complained/noticed that the upgrade would take about 30 or so minutes, and it started off the question of why it was so slow.

After some prodding around, it seemed that when removing git from the root folder and thus essentially untracking all files, the upgrade went 10 minutes faster.

We then all did the same and sure enough it was roughly 10 minutes faster.

As a mitigation we have been copying the project into another folder thus not having git whizzing away in the background, and once the project has finished uploading, we put the project back into the original folder and then git picks up on the changes made in one big hit.

Question:

Is there a way to temporarily disable git from recording changes while the upgrade occurs and then enabling it after the upgrade is done so that it can re-assess the files changed after? My understanding of the situation is that git is probably writing every minor change that occurs while nuget is download and installing the new package to the project.

NB

I write this from an uncertain stand point. Okay, removing git makes it faster, but of course, i am unsure of what really is happening under the hood... so the question may be a bit moot in terms of git. But if we can figure it out, across the company it would save so much time!

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233
  • 3
    To my knowledge, git does not watch files continuously. Though some environments like windows may have something. Which OS and git software do you use? – max630 Oct 14 '19 at 16:50
  • 1
    Can you provide more info on your process/workflow? How did you conclude that it was Git related? As @max630 said - git does not track continuously (like i.e. Dropbox or Google Drive). Git adds changes once you decide to stage and commit them. – mimikrija Oct 14 '19 at 17:23
  • Thanks all, I have updated the question. I had originally tried to keep it basic, but now can see the context probably forms part of the issue. – Jimmyt1988 Oct 14 '19 at 17:38
  • @mimikrija - Thanks for taking the time to respond. I think we are looking at the git tracking being the issue here. If you were to for example look at source tree perhaps or even Visual Studio's own team explorer where changes are visible on the fly (and this may actually be the problem), you would see that the changes are listened in on and the commitable window grows as the files change. Once the upgrade completes, we make a commit and the job is done. But i think that process of git looking in on the files ready for the next git status may be the problem here. Not sure :) – Jimmyt1988 Oct 14 '19 at 17:47
  • Some versions of Git *do* have the ability to hook into a file system monitor. The process is inherently OS-dependent; I have no idea if or how this works in any versions of Windows. – torek Oct 15 '19 at 01:33
  • 3
    It may be visual studio polling the project. Any chance to close it during the update? – max630 Oct 15 '19 at 04:57
  • 1
    @Jimmyt1988 I'd also vote for Visual Studio being the one holding up the process.. – mimikrija Oct 15 '19 at 07:12
  • All... thank you for your responses, I think you're right. Now i just have to figure out how to disconnect visual studio's tracking in team explorer and then i can test the hypothesis – Jimmyt1988 Oct 15 '19 at 12:34

1 Answers1

1

To prevent Git from tracking changes in solution temporarily, simply set the Source Control Plug-in to none in Visual Studio via Tools > Options > Source Control > Plug-in Selection:

Tools > Options > Source Control > Plug-in Selection

Note that your solution will be forced to close, you'll need to re-open it.

Once you do, you'll see that Team Explorer isn't tracking changes as Git isn't the currently selected Source Control plug-in:

Git is not the current Source Control plug-in

martinthebeardy
  • 742
  • 1
  • 7
  • 18