mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-23 07:31:57 +00:00
Add tests for complex git submodule scenarios
This commit is contained in:
parent
c3f9d04354
commit
9d84e6fb6a
1 changed files with 75 additions and 2 deletions
|
@ -386,8 +386,6 @@ function testDetectingUntrackedFilesInSubmodulesWork() {
|
||||||
git init 1>/dev/null
|
git init 1>/dev/null
|
||||||
touch "i-am-tracked.txt"
|
touch "i-am-tracked.txt"
|
||||||
git add . 1>/dev/null && git commit -m "Initial Commit" 1>/dev/null
|
git add . 1>/dev/null && git commit -m "Initial Commit" 1>/dev/null
|
||||||
# Create untracked file
|
|
||||||
touch "i-am-untracked.txt"
|
|
||||||
|
|
||||||
local submodulePath="${PWD}"
|
local submodulePath="${PWD}"
|
||||||
|
|
||||||
|
@ -395,6 +393,81 @@ function testDetectingUntrackedFilesInSubmodulesWork() {
|
||||||
git submodule add "${submodulePath}" 2>/dev/null
|
git submodule add "${submodulePath}" 2>/dev/null
|
||||||
git commit -m "Add submodule" 1>/dev/null
|
git commit -m "Add submodule" 1>/dev/null
|
||||||
|
|
||||||
|
# Go into checked-out submodule path
|
||||||
|
cd submodule
|
||||||
|
# Create untracked file
|
||||||
|
touch "i-am-untracked.txt"
|
||||||
|
cd -
|
||||||
|
|
||||||
|
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||||
|
|
||||||
|
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function testDetectinUntrackedFilesInMainRepoWithDirtySubmodulesWork() {
|
||||||
|
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
|
||||||
|
|
||||||
|
local submodulePath="${PWD}"
|
||||||
|
|
||||||
|
cd -
|
||||||
|
git submodule add "${submodulePath}" 2>/dev/null
|
||||||
|
git commit -m "Add submodule" 1>/dev/null
|
||||||
|
|
||||||
|
# Create untracked file
|
||||||
|
touch "i-am-untracked.txt"
|
||||||
|
|
||||||
|
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||||
|
|
||||||
|
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function testDetectingUntrackedFilesInNestedSubmodulesWork() {
|
||||||
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
|
||||||
|
local POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY="true"
|
||||||
|
unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND
|
||||||
|
|
||||||
|
local mainRepo="${PWD}"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
local submodulePath="${PWD}"
|
||||||
|
|
||||||
|
mkdir ../subsubmodule
|
||||||
|
cd ../subsubmodule
|
||||||
|
git init 1>/dev/null
|
||||||
|
touch "i-am-tracked-too.txt"
|
||||||
|
git add . 1>/dev/null && git commit -m "Initial Commit" 1>/dev/null
|
||||||
|
|
||||||
|
local subsubmodulePath="${PWD}"
|
||||||
|
|
||||||
|
cd "${submodulePath}"
|
||||||
|
git submodule add "${subsubmodulePath}" 2>/dev/null
|
||||||
|
git commit -m "Add subsubmodule" 1>/dev/null
|
||||||
|
cd "${mainRepo}"
|
||||||
|
git submodule add "${submodulePath}" 2>/dev/null
|
||||||
|
git commit -m "Add submodule" 1>/dev/null
|
||||||
|
|
||||||
|
git submodule update --init --recursive 2>/dev/null
|
||||||
|
|
||||||
|
cd submodule/subsubmodule
|
||||||
|
# Create untracked file
|
||||||
|
touch "i-am-untracked.txt"
|
||||||
|
cd -
|
||||||
|
|
||||||
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
source ${P9K_HOME}/powerlevel9k.zsh-theme
|
||||||
|
|
||||||
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
|
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
|
||||||
|
|
Loading…
Reference in a new issue