Prototypes LoomP35 · Git in the page

Loom against Git

Git 2.50.1 on the Mac that made this corpus built every history below from a script, with fixed authors, dates and time zones, and recorded its answers: every object id, git log, git diff with Myers and patience, git merge-base, git merge-tree and git blame. This page builds the same histories with Loom, in this browser, and compares each answer with Git’s, character for character.

Working. The corpus is being loaded and run.

Objects

CaseWhat Git was askedResultDetail

Packs

CaseWhat Git was askedResultDetail

Diff

CaseWhat Git was askedResultDetail

Merge

CaseWhat Git was askedResultDetail

Renames in merges

CaseWhat Git was askedResultDetail

Blame

CaseWhat Git was askedResultDetail

Log

CaseWhat Git was askedResultDetail

The fuzzer

CaseWhat Git was askedResultDetail

What Loom wrote, checked by Git

CaseWhat Git was askedResultDetail
How Loom is built
  1. Loom is Git written for this prototype in plain JavaScript, with no dependencies. It reads and writes Git’s own formats: loose objects, packs with their .idx, refs, packed-refs, HEAD and the index. A repository Loom makes is one Git accepts, and one Git makes is one Loom reads.
  2. An object’s id is the SHA-1 of its kind, its size and its bytes. Loom hashes with its own SHA-1, deflates and inflates with its own zlib, and writes trees in Git’s order, where a folder sorts as if its name ended in a slash.
  3. A pack holds objects one after another with no lengths between them, many stored as deltas against another object. Loom’s inflate says where each stream ended, so it can read a pack from its first byte. It resolves the deltas, works out every id and writes the .idx. It also writes packs with deltas of its own.
  4. The diff is Git’s xdiff written again: Myers’ algorithm with xdiff’s preparation and heuristics, patience and histogram diff, and the indent heuristic that decides where a group of changed lines starts. git diff’s output follows, with the function line Git puts after each hunk header.
  5. A merge works as Git’s ort strategy does. When two branches have more than one merge base, the bases are merged first into a virtual base. Renames are found first on each side, so a file renamed on one side and changed on the other is merged at its new name. Files both sides changed are merged line by line, and conflicts are written with Git’s markers for you to resolve.
  6. Blame walks from the newest commit down, passing each line a commit did not change to its parent, the way git blame does.
  7. The repository is kept in IndexedDB in this browser. Download gives the whole repository as a folder with its .git inside, as a zip or a tar: unpack it and run git log, git status or git fsck on it.
  8. Clone speaks Git’s protocol version 2 over HTTP: ls-refs for the refs, then fetch with want and done. The pack comes back on side-band 64k with the server’s progress, and a Web Worker resolves it. GitHub does not let a browser call it directly, so this site’s Worker passes the protocol on to github.com and keeps nothing.
  9. Loom is held against Git 2.50.1 itself. A script builds scripted histories and 70 fuzz seeds with Git and records Git’s answers, and the page against Git compares Loom’s answers with them. The other way, Git checks the repositories Loom writes with git fsck --strict, git verify-pack, git log and git status.