Skip to content

Commit

Permalink
fix: compatibility with exist v5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
line-o committed Nov 22, 2023
1 parent 436e12b commit f3742b8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/api.xql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ declare function api:repo-xml ($info as map(*)) as element(repo) {
declare function api:collection-info ($collection as xs:string) as map(*) {
let $collection-config := api:get-collection-config($collection)
(: hide passwords and tokens :)
let $masked := map:remove($collection-config, ("hookpasswd", "token"))
let $masked := map:remove(map:remove($collection-config, "hookpasswd"), "token")

return
try {
Expand Down
12 changes: 9 additions & 3 deletions src/modules/github.xql
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ declare function github:get-changes ($collection-config as map(*)) as map(*) {
:)
declare function github:remove-or-ignore ($changes as map(*), $filename as xs:string) as map(*) {
if ($filename = $changes?new)
then map:put($changes, "new", $changes?new[. ne $filename]) (: filter document from new :)
then
let $filtered := $changes?new[. ne $filename]
return map {
"new": $filtered,
"del": $changes?del
}
else map:put($changes, "del", ($changes?del, $filename)) (: add document to be removed :)
};

Expand All @@ -159,8 +164,9 @@ declare function github:aggregate-filechanges ($changes as map(*), $next as map(
then $changes
else map:put($changes, "new", ($changes?new, $next?filename))
case "renamed" return
github:remove-or-ignore($changes, $next?previous_filename)
=> map:put("new", ($changes?new, $next?filename))
github:remove-or-ignore(
map:put($changes, "new", ($changes?new, $next?filename)),
$next?previous_filename)
case "removed" return
github:remove-or-ignore($changes, $next?filename)
default return
Expand Down
42 changes: 42 additions & 0 deletions test/fixtures/alternative-tuttle-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<tuttle>
<repos>
<collection name="tuttle-sample-data">
<default>true</default>
<type>github</type>
<baseurl>https://api.github.com/</baseurl>
<owner>eeditiones</owner>
<repo>tuttle-sample-data</repo>
<token>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</token>
<ref>next</ref>
<hookuser>admin</hookuser>
<hookpasswd></hookpasswd>
</collection>

<collection name="tuttle-sample-gitlab">
<type>gitlab</type>
<baseurl>https://gitlab.com/api/v4/</baseurl>
<owner>line-o</owner>
<repo>tuttle-sample-data</repo>
<project-id>50872175</project-id>
<token>glpat-BvX-RTa-XRfkeL3WyWA2</token>
<ref>main</ref>
<hookuser>admin</hookuser>
<hookpasswd></hookpasswd>
</collection>
</repos>

<ignore>
<file>existdb.json</file>
<file>build.xml</file>
<file>README.md</file>
<file>.gitignore</file>
<file>expath-pkg.xml.tmpl</file>
<file>repo.xml.tmpl</file>
<file>build.properties.xml</file>
</ignore>


<config prefix="/db/apps/" suffix="-stage" lock="git-lock.xml" apikeys="/db/system/auth/tuttle-token.xml">
<sm user="guest" group="guest" mode="rw-r--r--"/>
</config>
</tuttle>

0 comments on commit f3742b8

Please sign in to comment.