aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-11-03 05:21:47 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-11-03 05:21:47 +0300
commit44b4b669258f0854e17e439337a8a8fdf1dea5df (patch)
treee10d6f7b0bd839715ba30e334d30eb4497d15580 /test
parentd07507c1ebf60d1d71ba491d0358b312e3e44807 (diff)
Speedup VCS segment
Now the untracked files are detected via `git ls-files`, which is much faster than `git status`. Additionally, we flipped the default for checking submodules. They are now NOT checked by default, as most users probably do not use git submodules.
Diffstat (limited to 'test')
-rwxr-xr-xtest/segments/vcs-git.spec25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec
index bddecf6c..21bdc892 100755
--- a/test/segments/vcs-git.spec
+++ b/test/segments/vcs-git.spec
@@ -375,4 +375,29 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() {
assertEquals "%K{002} %F{000} master %k%F{002}%f " "$(build_left_prompt)"
}
+function testDetectingUntrackedFilesInSubmodulesWork() {
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
+ local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY="true"
+ unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND
+
+ mkdir ../submodule
+ cd ../submodule
+ git init 1>/dev/null
+ touch "i-am-tracked.txt"
+ git add . 1>/dev/null && git commit -m "Initial Commit" 1>/dev/null
+ # Create untracked file
+ touch "i-am-untracked.txt"
+
+ local submodulePath="${PWD}"
+
+ cd -
+ git submodule add "${submodulePath}" 2>/dev/null
+ git commit -m "Add submodule" 1>/dev/null
+
+ source ${P9K_HOME}/powerlevel9k.zsh-theme
+
+ assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
+}
+
source shunit2/shunit2 \ No newline at end of file