gitless icon indicating copy to clipboard operation
gitless copied to clipboard

Speed up branch switching and/or show progress bar when repo has lots of untracked/ignored files

Open spderosso opened this issue 11 years ago • 7 comments

spderosso avatar Jan 26 '14 19:01 spderosso

It would be nice if there could be more user feedback when an operation takes more than a few seconds.

internalfx avatar Dec 26 '16 16:12 internalfx

I'm eager to use gitless, but using gl switch at work takes ~10s in our main repository. The culprit seems to be the node_modules directory.

Before removing:

$ time gl switch master
✔ Switched to branch master
gl switch master  2.00s user 5.56s system 79% cpu 9.480 total

After removing:

$ time gl switch master
✔ Switched to branch master
gl switch master  0.61s user 0.67s system 86% cpu 1.484 total

lambdahands avatar Jan 12 '17 21:01 lambdahands

Could you explain what node_module is ? Is it part of gitless, git or your project ?

chmike avatar Jan 13 '17 12:01 chmike

@chmike node_modules is a directory that gets created in nodejs projects with all the dependencies of a project (it's not part of gitless or git)

@lambdahands yeah, it sucks. We currently use stash to save everything but that gets really slow when there are lots of files to stash. We are going to have to find a different way of doing it. As a temporary workaround until we fix this you can use the -mo/--move-over flag of gl switch that will move over the changes to the destination branch. (Unfortunately this means you won't be getting independent branches but at least you won't have to wait 10s to switch.) At some point I'd like -mo/--move-over to accept files as input, that way you'd be able to do something like gl switch master -mo node_modules/ to switch to master but keep the node_modules dir

spderosso avatar Jan 14 '17 21:01 spderosso

This is another reason why I'd like to see gitless ignore files listed in .gitignore when switching branches. If node_modules was ignored then the switching of branches would not be slow. Stashing with '--include-untracked' and not '--all' solves the problem.

andrewsawczyn avatar Jul 14 '17 13:07 andrewsawczyn

I agree with andrewsawczyn that there should, at least, be an option for gitless to not stash ignored files. The project I'm working on at the moment has 80,000+ ignored files in node_modules and other folders, which should not be stashed when switching branches. "gl switch" takes upwards of five minutes (It took so long, I killed the task before it finished).

Mooninaut avatar Jan 08 '19 14:01 Mooninaut

I agree, a simple change we could do is to add a flag to keep ignored files when switching branches. PR's welcome!

At some point, a friend of mine suggested adding the concept of a "sticky" file. The idea being to keep file classifications that determine what gets shown in status and what gets committed by default (ignored, tracked, untracked) separate from whether you want a file to follow you when you switch branches or not. This would be more work (so adding a flag to switch is probably best for now) but I'd love your thoughts on this.

spderosso avatar Jan 08 '19 18:01 spderosso