kinda unexported
parent
c6b40404cb
commit
3d9cfc2f95
|
|
@ -141,15 +141,15 @@ gitlab() (
|
|||
echo "$*" | grep -q gitlab.app && ! echo "$*" | grep -q '/wiki/'
|
||||
}
|
||||
|
||||
gcurl() {
|
||||
local cache_key="gitlab gcurl $*"
|
||||
_gcurl() {
|
||||
local cache_key="gitlab _gcurl $*"
|
||||
if cache get "$cache_key"; then
|
||||
return 0
|
||||
fi
|
||||
_gcurl "$@" | cache put "$cache_key"
|
||||
__gcurl "$@" | cache put "$cache_key"
|
||||
}
|
||||
|
||||
_gcurl() {
|
||||
__gcurl() {
|
||||
curl -sS -H "Authorization: Bearer $GITLAB_PAT" "$@"
|
||||
}
|
||||
|
||||
|
|
@ -163,12 +163,12 @@ gitlab() (
|
|||
|
||||
_expand() {
|
||||
local url="$1"
|
||||
local project="$(url_to_project_root "$url" | head -n 1)"
|
||||
local root="$(url_to_project_root "$url" | tail -n 1)"
|
||||
local project="$(_url_to_project_root "$url" | head -n 1)"
|
||||
local root="$(_url_to_project_root "$url" | tail -n 1)"
|
||||
__expand "$project" "$root"
|
||||
}
|
||||
|
||||
url_to_project_root() {
|
||||
_url_to_project_root() {
|
||||
local url="$1"
|
||||
local url_path="${url#http*://gitlab*.net/}"
|
||||
local project="${url_path%%/-/*}"
|
||||
|
|
@ -199,7 +199,7 @@ gitlab() (
|
|||
| grep .
|
||||
}
|
||||
while [ "$i" -lt "${#b64_trees[@]}" ]; do
|
||||
got="$(list_tree "$project" "${b64_trees[i]}")"
|
||||
got="$(_list_tree "$project" "${b64_trees[i]}")"
|
||||
for b64_tree in $(find_each "tree" "$got"); do
|
||||
if ! echo "${b64_trees[@]}" | grep -q "[ ^]$b64_tree[ $]"; then
|
||||
b64_trees+=("$b64_tree")
|
||||
|
|
@ -217,11 +217,11 @@ gitlab() (
|
|||
done
|
||||
}
|
||||
|
||||
list_tree() {
|
||||
_list_tree() {
|
||||
local project="$(urlencode "$1")"
|
||||
local path="/api/v4/projects/$project/repository/tree"
|
||||
local query="recursive=true&path=$2"
|
||||
gcurl "https://gitlab-app.eng.qops.net/$path?$query"
|
||||
_gcurl "https://gitlab-app.eng.qops.net/$path?$query"
|
||||
}
|
||||
|
||||
"$@"
|
||||
|
|
|
|||
Loading…
Reference in New Issue