Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adélie Infrastructure
Container Services
Commits
f1fffcfa
Commit
f1fffcfa
authored
Oct 22, 2021
by
Zach van Rijn
Browse files
cgit.a.o: implement 'idle' to mean time since most recent commit to any branch
parent
772ef50d
Changes
1
Hide whitespace changes
Inline
Side-by-side
cgit.adelielinux.org/update
View file @
f1fffcfa
...
...
@@ -18,20 +18,30 @@ mkdir -p "${DATA}";
#
sync
()
{
# cache server response
# TODO: support pagination
##
# Cache GitLab API server response (JSON) as pre-parsed CSV data.
# TODO: support pagination (API supports max 100 results per page).
#
curl
-s
${
GLAB
}
/api/v4/groups/
${
1
}
/projects?per_page
=
100
\
| jq
-r
'.[] | select(.archived == false) | .http_url_to_repo + "%" + .description'
>
"
${
KEEP
}
"
;
# clone, pull, and/or update descriptions for current repositories
##
# Clone, pull, and/or update descriptions for current repositories.
#
while
read
k
;
do
(
repo
=
${
k
%\%*
}
;
name
=
${
repo
##*/
}
;
desc
=
${
k
#*\%
}
;
cd
"
${
DATA
}
"
;
mkdir
-p
${
1
}
;
cd
${
1
}
;
##
# Core data.
#
if
!
test
-d
${
name
%.*
}
;
then
mkdir
${
name
%.*
}
;
git clone
--mirror
${
repo
}
${
name
%.*
}
/.git
;
...
...
@@ -40,7 +50,28 @@ sync ()
else
git
-C
${
name
%.*
}
remote update
--prune
;
fi
##
# Write repository description from GitLab API for cgit to read.
#
printf
>
${
name
%.*
}
/.git/description
"%s"
"
${
desc
}
"
;
##
# Delete '.git/refs/' directory contents (cgit uses 'packed-refs' when empty).
# Find time of latest commit to any branch, and set 'packed-refs' mtime to it.
#
find
${
name
%.*
}
/.git/refs
-type
f
-delete
;
when
=
$(
git
-C
${
name
%.*
}
--no-pager
branch
-al
\
|
sed
-e
's/*//g'
\
|
while
read
b
;
do
git
-C
${
name
%.*
}
--no-pager
log
-1
--format
=
%cd
--date
=
unix
${
b
}
;
done
\
|
sort
-nr
\
|
head
-n
1
\
)
;
touch
--date
=
@
${
when
}
${
name
%.*
}
/.git/packed-refs
;
##
# Mark as wanting to keep this repository during cleanup.
#
printf
>>
"
${
HAVE
}
"
"%s/%s
\n
"
"
${
1
}
"
"
${
name
%.*
}
"
;
)
done
<
"
${
KEEP
}
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment