Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster status checks for huge git repos #1570

Merged
merged 4 commits into from Apr 24, 2013

Conversation

@yoavweiss
Copy link
Contributor

commented Jan 30, 2013

The current status check for git repos can take several seconds when dealing with huge repos (WebKit in my case). It means a ~10 seconds delay for each command ran on the CLI.
Thanks to some twitter ranting, @paulirish and https://gist.github.com/3898739, I replaced git status with git diff.
AFAICT, diff based dirty/clean reports are identical to those of status, while being an order of magnitude faster (around 0.5 sec for the WebKit repo on my machine).

@laggyluke

This comment has been minimized.

Copy link
Contributor

commented Feb 9, 2013

Got a small regression: it won't report "dirty" status when a new untracked file is created.

@jtheoof

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2013

It seems indeed much, much faster. I'll test a bit further and keep you posted if I find any bug.
I can confirm laggyluke comment: adding a new file, not tracked by git does not make the repo dirty.

yoavweiss added 2 commits Feb 13, 2013
Did a full circle and went back to # On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   git.zsh
#, ignoring untracked files, which seems to be the primary cause for slowness
@yoavweiss

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2013

@laggyluke @jtheoof Thanks for pointing out that regression. I could not find a way to add untracked files to the dirty check while keeping it fast. OTOH, git status while ignoring untracked files (-uno) is even faster than git diff.

@robbyrussell

This comment has been minimized.

Copy link
Owner

commented Mar 27, 2013

Thanks for this. I'm unsure if I want to accept just yet. The untracked files as dirty is quite useful to me... hmm.

@jtheoof

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2013

Is there any way to make it as an option? I agree that dirty untracked files could be useful but faster git status for large repo is too!

@robbyrussell

This comment has been minimized.

Copy link
Owner

commented Apr 8, 2013

@jtheoof / @yoavweiss if someone (nudge/wink) wants to add a way to disable considering untracked files as dirty to the .zshrc template, I'd consider that as a good way to approach this

@jtheoof

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2013

Hi there, I've created a new pull request with option set up in zshrc.template see #1745
Right now it will only work for git but should be extensible to svn, hg and more for who knows about them.
Let me know if you have any comment.

@yoavweiss

This comment has been minimized.

Copy link
Contributor Author

commented Apr 22, 2013

Thanks, @jtheoof ! Looks great :)

@robbyrussell robbyrussell merged commit 9245a30 into robbyrussell:master Apr 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.