1. 28
    1. 5

      See also: ValidAlloy: A tool for validating a git alloy specification using testcase generation. It is an impressive work where model refined using real testcases for real Git implementation.

      1. 3

        Oh wow! Thank you for sharing this. I’m gonna have to read it carefully

    2. 4

      Seems to me that modeling git internals is a really clever pedagogical choice here! Appreciate the post. Look forward to part 2.

    3. 3

      Nice start to the series.

      I’ve been doing a lot of Alloy modeling for practical applications. I’m also looking into stuff to model just for fun/learning. I think I found some educational opportunities.

      Keep posting! There’s not enough “real world” Alloy, every little bit helps.

    4. 3

      The graph or dag module contains an implementation of the tree predicate, which I started using instead of constraining the parent relation directly

      1. 1

        in Alloy, you mean? Does it have any side effects? (Like opening ordered on some sig making it fixed-size?)

        1. 3

          Nope! You can check it manually under open sample models > utils.

    5. 1

      I hope you continue this series. 1) git is a totally baroque system that I myself am constantly eluded by. 2) models help to understand such systems, and I’m always amazed how terse Alloy models can be.

      1. 2

        I plan to continue! I’ve already got a second part drafted getting to commits!

    6. 1

      From my forgotten Git internals knowledge, which is very sparse, I remember that the hashes can come from a textual representation, i.e., a tree is a file with a list of blobs, and the tree’s hash is the hash of the file, as any other object in Git.

      Given that, is it possible to have two trees with different hashes and the same objects?

      1. 1

        From a blog post by Mike Street:

        The git hash is made up of the following:

        • The commit message
        • The file changes
        • The commit author (and committer- they can be different)
        • The date
        • The parent commit hash

        So, as a trivial case, amending a commit message changes the hash, without changing any of the files.

      2. 1

        Yes, it’s possible. You’d need to get a SHA-1 hash collision. I linked to someone who did that in the post; they changed the git code to only take the first byte of the hash to see what happened (segfault)