group-hook: on %path group-update, don't %unbundle

Instead, %bundle and %add if we don't have the group locally yet,
or %add and %remove whatever the difference is between the local group
and the group as specified in the %path update.
This commit is contained in:
Fang 2020-03-27 12:38:08 +01:00
parent 4940501f3b
commit 4551c74e3a
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -191,10 +191,23 @@
=/ ship (~(get by synced.state) pax.diff)
?~ ship ~
?. =(src.bol u.ship) ~
:~ (group-poke pax.diff [%unbundle pax.diff])
(group-poke pax.diff [%bundle pax.diff])
=/ have-group=(unit group)
(group-scry pax.diff)
?~ have-group
:: if we don't have the group yet, create it
::
:~ (group-poke pax.diff [%bundle pax.diff])
(group-poke pax.diff [%add members.diff pax.diff])
==
:: if we already have the group, calculate and apply the diff
::
=/ added=group (~(dif in members.diff) u.have-group)
=/ removed=group (~(dif in u.have-group) members.diff)
%+ weld
?~ added ~
[(group-poke pax.diff [%add added pax.diff])]~
?~ removed ~
[(group-poke pax.diff [%remove removed pax.diff])]~
::
%add
:_ state