mirror of
https://github.com/zplug/zplug
synced 2025-04-30 13:17:57 +02:00
Added check for which branch is currently checked out so as not to rely on locks.
This commit is contained in:
parent
3dd2b40552
commit
eb6d792fc5
@ -115,6 +115,12 @@ __zplug::utils::git::checkout()
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if the repository is already checked out
|
||||
# with the branch we are looking for.
|
||||
if __zplug::utils::git::have_checked_out "$tags[at]"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if the repo is already locked by another process, and
|
||||
# pretend to return success. This happens most likely to oh-my-zsh
|
||||
# where multiple plugins refer to the same repo, and only one
|
||||
@ -144,6 +150,11 @@ __zplug::utils::git::have_cloned()
|
||||
[[ "$(git rev-parse HEAD 2>/dev/null)" != "HEAD" ]]
|
||||
}
|
||||
|
||||
__zplug::utils::git::have_checked_out()
|
||||
{
|
||||
[[ "$(git rev-parse --abbrev-ref HEAD)" == "$1" ]]
|
||||
}
|
||||
|
||||
# TODO:
|
||||
# - __zplug::utils::git::fetch
|
||||
# - __zplug::utils::git::pull
|
||||
|
Loading…
Reference in New Issue
Block a user