24 March 2019

Example git persistent data structure

To continue on the post of Persistent data structure and git, I've created this repo: https://github.com/mhewedy-playground/how-get-works

Looking into the objects database, here's the database objects exposed:

$ git log
commit d5ef93b09fe8d80fa903894a1bac93d3a67d55d3 (HEAD -> master)
Author: Muhammad Hewedy <mhewedy@gmail.com>
Date:   Mon Mar 25 00:09:37 2019 +0300

commit 16dc45d02209a4bfcb26b066f18bf290507cf87f
Author: Muhammad Hewedy <mhewedy@gmail.com>
Date:   Mon Mar 25 00:05:20 2019 +0300
---------------------------------------------------------------------
# first commit tree
$ git cat-file -p 16dc
tree 029ec860ecb064cf689695c176a5baafc910916a
author Muhammad Hewedy <mhewedy@gmail.com> 1553461520 +0300
committer Muhammad Hewedy <mhewedy@gmail.com> 1553461520 +0300

$ git cat-file -p 029e
040000 tree e9199b34206372b3d2b1e2c06b3ccfeaef6d8804 a

$ git cat-file -p e919
040000 tree b1d74266c8b55b9cd7796c056888b6edcc1d1a98 b

$ git cat-file -p b1d7
040000 tree 68aba62e560c0ebc3396e8ae9335232cd93a3f60 c

$ git cat-file -p 68ab
100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad hello.txt
---------------------------------------------------------------------
# second (HEAD/master) commit tree
$ git cat-file -p d5ef
tree 9d0986abb4d98c7b1a26e6a4efe2156981ebd583
parent 16dc45d02209a4bfcb26b066f18bf290507cf87f
author Muhammad Hewedy <mhewedy@gmail.com> 1553461777 +0300
committer Muhammad Hewedy <mhewedy@gmail.com> 1553461777 +0300

$ git cat-file -p 9d09
040000 tree 48bc9a2ae3efb7aef6095e4db249a5775b71d155 a

$ git cat-file -p 48bc
040000 tree 5899cb357c13a7e7fa8aacc9b73ad741877d5390 b

$ git cat-file -p 5899
040000 tree 68aba62e560c0ebc3396e8ae9335232cd93a3f60 c
100644 blob 345e6aef713208c8d50cdea23b85e6ad831f0449 test.txt

$ git cat-file -p 68ab
100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad hello.txt


Which is represented by the following diagram






No comments: