Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib/repo/clone.sh
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2023-01-30 21:15:50 +0100
committerLevente Polyak <anthraxx@archlinux.org>2023-05-20 00:08:12 +0200
commiteda3a4aea00803d14400beff819d3b8be81774ce (patch)
tree78cb26de73b6632d4b40222f9055f1f23d380f18 /src/lib/repo/clone.sh
parentf669a71e847da88fefc1296dd2dd9ba82549a8c6 (diff)
gitlab: add project path function to map special chars
Automatic path conversion is limited to GitLab API v4 and will be removed in the future. It's expected that the caller does the path conversion on caller side and only passes a valid path to the API within its limitations. Hence convert project names to valid paths: 1. replace single '+' between word boundaries with '-' 2. replace any other '+' with literal 'plus' 3. replace any special chars other than '_', '-' and '.' with '-' 4. replace consecutive '_-' chars with a single '-' 5. replace 'tree' with 'unix-tree' due to GitLab reserved keyword Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src/lib/repo/clone.sh')
-rw-r--r--src/lib/repo/clone.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/repo/clone.sh b/src/lib/repo/clone.sh
index 4b26fcf..dee4870 100644
--- a/src/lib/repo/clone.sh
+++ b/src/lib/repo/clone.sh
@@ -54,6 +54,9 @@ pkgctl_repo_clone() {
local CONFIGURE_OPTIONS=()
local pkgbases
+ # variables
+ local project_path
+
while (( $# )); do
case $1 in
-h|--help)
@@ -126,7 +129,8 @@ pkgctl_repo_clone() {
for pkgbase in "${pkgbases[@]}"; do
if [[ ! -d ${pkgbase} ]]; then
msg "Cloning ${pkgbase} ..."
- remote_url="${GIT_REPO_BASE_URL}/${pkgbase}.git"
+ project_path=$(gitlab_project_name_to_path "${pkgbase}")
+ remote_url="${GIT_REPO_BASE_URL}/${project_path}.git"
git clone --origin origin "${remote_url}" "${pkgbase}"
else
warning "Skip cloning ${pkgbase}: Directory exists"