aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-10-02 12:43:20 +0000
committermerakor <cem@ckyln.com>2020-10-02 12:43:20 +0000
commitae4ac2108b6425f286769edc24997a75405a04ed (patch)
tree65d3c88ce4e8175b417006b2c9acc517e9e735d2 /src
parent8e8aa9345d8df42eae2a468929336fdad38c39dd (diff)
downloadcpt-ae4ac2108b6425f286769edc24997a75405a04ed.tar.gz
pkg_extract(): allow the usage of '@' for tags.
This change ensures that we don't have to acquire tags each time. The user can specify https://blabla.git@v2 to acquire the v2 tag. This is not needed for branches or commits. FossilOrigin-Name: 5f8d147c298113f235c28b992e7dba0ec39d19eaae368e5cd7bc359cceb24ecb
Diffstat (limited to 'src')
-rw-r--r--src/cpt-lib6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cpt-lib b/src/cpt-lib
index ebd55a0..6686a81 100644
--- a/src/cpt-lib
+++ b/src/cpt-lib
@@ -561,7 +561,11 @@ pkg_extract() {
log "$1" "Cloning ${url%[@#]*}"; {
git init
git remote add origin "${url%[@#]*}"
- git fetch "${com:+-t}" --depth=1 origin "$com" || git fetch
+ case "$url" in
+ # Tags are specified via '@'
+ *@*) git fetch -t --depth=1 origin "$com" || git fetch ;;
+ *) git fetch --depth=1 origin "$com" || git fetch
+ esac
git checkout "${com:-FETCH_HEAD}"
} || die "$1" "Failed to clone $src"
;;