mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-24 08:00:05 -07:00
kiss: less git pulls
This commit is contained in:
parent
a4ee893169
commit
d9109773d0
27
kiss
27
kiss
@ -193,10 +193,16 @@ pkg_sources() {
|
|||||||
|
|
||||||
log "$1" "Cloning ${repo_src%#*}"
|
log "$1" "Cloning ${repo_src%#*}"
|
||||||
|
|
||||||
[ "${src##*#*}" ] && shallow=--depth=1
|
# If a commit hash or branch was given, grab the latest
|
||||||
|
# commit from all branches. This gives a speed-up when
|
||||||
|
# wanting to checkout a specific branch.
|
||||||
|
[ "${src##*#*}" ] ||
|
||||||
|
branch=--no-single-branch
|
||||||
|
|
||||||
|
# Always do a shallow clone as we will unshallow it if
|
||||||
|
# needed later (when a commit is desired).
|
||||||
cd "$mak_dir/$1/$dest" &&
|
cd "$mak_dir/$1/$dest" &&
|
||||||
git clone "${shallow:---}" "${repo_src%#*}" .
|
git clone --depth=1 "${branch:---}" "${repo_src%#*}" .
|
||||||
|
|
||||||
) || die "$1" "Failed to clone $src"
|
) || die "$1" "Failed to clone $src"
|
||||||
|
|
||||||
@ -234,8 +240,21 @@ pkg_extract() {
|
|||||||
git+*\#*)
|
git+*\#*)
|
||||||
log "Checking out ${src##*#}"
|
log "Checking out ${src##*#}"
|
||||||
|
|
||||||
git -c advice.detachedHead=false checkout "${src##*#}" ||
|
(
|
||||||
die "Commit hash ${src##*#} doesn't exist"
|
set -- git -c advice.detachedHead=false checkout
|
||||||
|
|
||||||
|
# Try to checkout the commit or branch. If it fails,
|
||||||
|
# unshallow the repository as we're dealing with a
|
||||||
|
# specific commit.
|
||||||
|
"$@" "${src##*#}" >/dev/null 2>&1 ||
|
||||||
|
git fetch --unshallow
|
||||||
|
|
||||||
|
# Checkout the repository a second time. If this
|
||||||
|
# fails, the desired commit or branch doesn't exist.
|
||||||
|
# This will do nothing if the above checkout succeeded.
|
||||||
|
"$@" "${src##*#}" 2>/dev/null ||
|
||||||
|
die "${src##*#} doesn't exist"
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Git repository, comment or blank line.
|
# Git repository, comment or blank line.
|
||||||
|
Loading…
Reference in New Issue
Block a user