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
Merged

Conversation

yoavweiss
Copy link
Contributor

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

@gmiroshnykov
Copy link
Contributor

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

@jtheoof
Copy link
Contributor

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

# 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
Copy link
Contributor Author

@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
Copy link
Member

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
Copy link
Contributor

jtheoof 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
Copy link
Member

@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
Copy link
Contributor

jtheoof 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
Copy link
Contributor Author

Thanks, @jtheoof ! Looks great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants