Refine the diagram

This commit is contained in:
Martin Vuk 2025-12-11 11:53:16 +01:00
parent 1fed688a54
commit 21afea5276
3 changed files with 650 additions and 640 deletions

Binary file not shown.

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 366 KiB

Before After
Before After

View file

@ -14,7 +14,7 @@
#let commit-object(coord, hash, name, ..args) = node(
coord, align(left, [#text(size: 8pt, gray.darken(50%), raw(hash))\ #name]),
corner-radius: 7pt, fill: commit-color.lighten(50%), stroke: none, ..args)
#let tree-object(coord, hash, ..args) = commit-object(coord, hash, [tree],
#let tree-object(coord, hash, content, ..args) = commit-object(coord, hash, content,
width: 2cm, fill: blue.lighten(50%), ..args)
#let file-object(coord, hash, name, ..args) = commit-object(coord, hash, name,
width: 2cm, fill: gray.lighten(50%), ..args)
@ -91,47 +91,49 @@
commit-node((rel: (0, -1), to: <E1>), E2h, name: <E2>)
commit-node((rel: (0, -1), to: <E2>), E3h, fill: none, stroke: thindashed, name: <E3>)
// branches
node((rel: (-1, 0), to: <F>), [main], shape: hexagon, stroke: branch-color, name: <main>)
node((rel: (-1, 0), to: <F>), [main], shape: chevron, stroke: branch-color, name: <main>)
edge(<main>, <F>, "->", stroke: thin)
node((rel: (-2, 0), to: <E2>), [hotfix], shape: hexagon, stroke: branch-color, name: <hotfix>)
node((rel: (-2, 0), to: <E2>), [hotfix], shape: chevron, stroke: branch-color, name: <hotfix>)
edge(<hotfix>, <E2>, "->", stroke: thin)
// tags
node((rel: (-1, 0), to: <E>), [v-1.0], shape: chevron, stroke: tag-color, name: <v1>)
edge(<v1>, <E>, "->", stroke: thin)
node((rel: (-1, 0), to: <B>), [v-1.1], shape: chevron, stroke: tag-color, name: <v2>)
edge(<v2>, <B>, "->", stroke: thin)
node((rel: (-1, 0), to: <E>), [v-2.0], shape: chevron, stroke: tag-color, name: <v2>)
edge(<v2>, <E>, "->", stroke: thin)
node((rel: (-1, 0), to: <B>), [v-1.0], shape: chevron, stroke: tag-color, name: <v1>)
edge(<v1>, <B>, "->", stroke: thin)
node((rel: (0.5, 0), to: <B2>), [v-1.1], shape:chevron.with(dir: left), stroke: tag-color, name: <v11>)
edge(<v11>, <B2>, "->", stroke: thin)
// enclose the tree
node((rel: (0, -1), to: <F>), [*Version history*\
#align(left, text(size: 8pt)[
#align(left, text(size: 10pt)[
_Directed Acyclic Graph (DAG)_ describes version history.
Commits are nodes in DAG, while an edge connect a commit with its parent.
Commits are nodes in DAG. Commits are connected with their parents.
])], stroke:none, width: 5cm, name: <history>)
node(snap: false, enclose: (<A>, <history>, <E3>), stroke: thindashed, width: 3cm, fill: gray.lighten(70%))
// branch cloud
node((rel: (-0.5, -1), to: <hotfix>), [#text(branch-color.darken(20%), smallcaps[*Branches*])\ references that move along when commiting canges],
node((rel: (-0.5, -1), to: <hotfix>), [#text(branch-color.darken(20%), smallcaps[*Branches*])\ references that move along when commiting changes],
stroke: thin, corner-radius: 10pt, inset: 5pt, width: 4cm, name: <branch>)
edge(<branch>, <hotfix>, corner: left, stroke: thindotted)
edge(<branch>, <main>, corner: left, stroke: thindotted)
// tag cloud
node((rel: (-0.5, 1.5), to: <v1>), [#text(tag-color, smallcaps[*Tags*])\ references that don't move],
node((rel: (-0.5, 1.5), to: <v2>), [#text(tag-color, smallcaps[*Tags*])\ references that don't move],
stroke: thin, corner-radius: 10pt, inset: 5pt, width: 4cm, name: <tag>)
edge(<tag>, <v1>, corner: right, stroke: thindotted)
edge(<tag>, <v2>, corner: left, stroke: thindotted)
edge(<tag>, <v2>, corner: right, stroke: thindotted)
edge(<tag>, <v1>, corner: left, stroke: thindotted)
// staging area
node((rel: (1, 0), to: <E3>), [#smallcaps[*Staging area*]\ #text(size: 8pt)[filesystem snapshot that will be commited in
the next commit]], stroke: thindashed, corner-radius: 10pt, width: 3cm, name: <stage>)
node((rel: (1, 0), to: <E3>), [#smallcaps[*Staging area*]\ #text(size: 10pt)[filesystem snapshot that will be commited in
the next commit]], stroke: thindashed, corner-radius: 10pt, width: 4.5cm, name: <stage>)
edge(<E3>, <stage>, stroke: thindotted)
// commit
node((rel: (1, 0.5), to: <E1>), [
#text(commit-color, smallcaps[*Commit*])\ snapshot of filesystem tree in object store\
#text(commit-color, smallcaps[*Commit*])\ file tree snapshot with metadata in object store\
#table(columns: 1, fill: commit-color.lighten(50%), align: left, [commit hash: #raw(E1h)],
raw(block: true, "
tree 65c47fee
parent 16f299
author MV <mv@ex...
author Martin Vuk
committer MV <mv...
Change foo".replace("16f299", E2h).replace("65c47fee", tree1h)
Add bla".replace("16f299", Eh).replace("65c47fee", tree1h)
)
)
], width:5cm, stroke: thin, corner-radius: 10pt, name: <commit>)
@ -161,7 +163,7 @@ Change foo".replace("16f299", E2h).replace("65c47fee", tree1h)
edge(<E>, <D>, "->")
edge(<F>, <E>, "->")
// merged branch
edge(<B1>, <B>, "->", layer: 1, label: [parent of], label-angle: auto)
edge(<B1>, <B>, "->", layer: 1, label: [parent], label-angle: auto)
edge(<B2>, <B1>, "->")
edge(<D>, <B2>, "->")
// unmerged branch
@ -169,21 +171,21 @@ Change foo".replace("16f299", E2h).replace("65c47fee", tree1h)
edge(<E2>, <E1>, "->")
edge(<E3>, <E2>, "->", stroke: (dash: "dashed"))
// object store
let obj_store = (rel: (-0.5, 1), to: <A>)
node((rel: (4cm, -2.2cm), to: <A>), align(left)[Content addressable object store \ #raw(".git/objects")], stroke: none, snap: false )
commit-object((rel: (1.5, 2), to: <A>), E1h, [second commit], name: <obj-c1>)
commit-object((rel: (1.5, 3), to: <A>), "16f29a", [first commit], width: 2.8cm, name: <obj-c2>)
tree-object((rel:(-1, 0), to: <obj-c1>), tree1h, name:<tree1>)
let bla_h = "d1bc32"
node((rel: (4cm, -2.5cm), to: <A>), align(center)[Content addressable object store \ #raw(".git/objects")], stroke: none, snap: false )
commit-object((rel: (1.5, 2), to: <A>), E1h, [Add bla], name: <obj-c1>)
commit-object((rel: (1.5, 3), to: <A>), Eh, [Merge commit], name: <obj-c2>)
tree-object((rel:(-1, 0), to: <obj-c1>), tree1h, [tree], name:<tree1>)
edge(<obj-c1>, <tree1>, stroke: thin, "->")
tree-object((rel:(-1, 0), to: <obj-c2>), "e05dcd", name: <tree2>)
tree-object((rel:(-1, 0), to: <obj-c2>), "e05dcd",[tree], name: <tree2>)
edge(<obj-c2>, <tree2>, stroke: thin, "->")
file-object((rel:(-1, -1), to: <tree1>), "cb48cd", [`new content`], name: <f1>)
file-object((rel:(-1, 0), to: <tree1>), "077231", [`unchanged`], name: <f2>)
file-object((rel:(-1, 1), to: <tree1>), "d1bc32", [`first content`], name: <f3>)
edge(<tree1>, <f2>, [`bar.txt`], "->", label-angle: auto, stroke: thin)
edge(<tree1>, <f1>, [`foo.txt`], "->", label-angle: auto, stroke: thin)
edge(<tree2>, <f2>, [`bar.txt`], "->", label-angle: auto, stroke: thin)
edge(<tree2>, <f3>, [`foo.txt`], "->", label-angle: auto, stroke: thin)
file-object((rel:(-1, -0.5), to: <tree1>), "cb48cd", [`bla bla`], name: <f1>)
file-object((rel:(-1, 0.5), to: <tree1>), "077231", [`lorem`], name: <f2>)
file-object((rel:(-1, 1.5), to: <tree1>), bla_h, [`bla`], name: <f3>)
edge(<tree1>, <f2>, [`bar`], "->", label-angle: auto, stroke: thin)
edge(<tree1>, <f1>, [`foo`], "->", label-angle: auto, stroke: thin)
edge(<tree2>, <f2>, [`bar`], "->", label-angle: auto, stroke: thin)
edge(<tree2>, <f3>, [`foo`], "->", label-angle: auto, stroke: thin)
node((rel: (0, 0.5), to:<A>), enclose: (<obj-c2>, <f1>, <f3>), stroke: thindashed, corner-radius: 5pt,
fill: gray.lighten(70%), snap: false, layer: -2)
// time direction