mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 13:04:17 +03:00
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:
parent
4940501f3b
commit
4551c74e3a
@ -191,10 +191,23 @@
|
|||||||
=/ ship (~(get by synced.state) pax.diff)
|
=/ ship (~(get by synced.state) pax.diff)
|
||||||
?~ ship ~
|
?~ ship ~
|
||||||
?. =(src.bol u.ship) ~
|
?. =(src.bol u.ship) ~
|
||||||
:~ (group-poke pax.diff [%unbundle pax.diff])
|
=/ have-group=(unit group)
|
||||||
(group-poke pax.diff [%bundle pax.diff])
|
(group-scry pax.diff)
|
||||||
(group-poke pax.diff [%add members.diff 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
|
%add
|
||||||
:_ state
|
:_ state
|
||||||
|
Loading…
Reference in New Issue
Block a user