-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add _lp_find_vcs() to find what VCS we are in
My long awaited feature: the one stop shop for finding what VCS repository the working directory is part of. Instead of calling each VCS binary to discover if we are in its type of repo, this function returns the type of repo we are in simply by looking for repo metadata files. And it's fast enough that we can call it each prompt. No more "cd ..; cd -" to get Liquidprompt to show the repo after an init! It does have a few flaws: not every VCS type will just work. Fossil needs its own case since it uses a file to store metadata instead of a directory. And VCSH and git-svn need special cases since they are stored inside of Git repos. But the current version is now faster, and uses less lines of code. Speedups range from 40 times faster than a "git rev-parse --is-inside-work-dir" when at the repo root to around 3 times while under a very deep directory tree. The key here is that while shell is always slower than C, running shell in a program already running in memory is faster than loading a new program into RAM.
- Loading branch information
Showing
1 changed file
with
57 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters