[WIP] start of changing types so that commits can have different parents

3e9007114319012034a710f5f08b483234ad5e5e

Tucker McKnight <tmcknight@instructure.com> | Sun Mar 29 2026

[WIP] start of changing types so that commits can have different parents

Commits need to have different parents on different branches. That is,
each branch has its own commit log. Therefore the "parent" cannot be
part of the commit object; the branch defines what the parent for a
given commit is.
src/dataTypes.ts:6
Before
5
6
7

















8
9
  blameLines: Array<BlameInfo>,
}

⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
export type Repository = {
  name: string,
  description?: string,
After
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  blameLines: Array<BlameInfo>,
}

export type Commit = {
  hash: string,
  // TODO: put cached files map in here. Save file as an object
  // so that it gets saved by reference.
  cachedFiles: Map<string, FileInfo>,
  message: string,
  isMerge: boolean,
  author: string,
  date: Date,
  diffs: Array<{
    fileName: string,
    lineNumber: number,
    beforeText: string,
    afterText: string,
  }>
}

export type Repository = {
  name: string,
  description?: string,
src/dataTypes.ts:26
Before
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    // the function so that we don't have to compute it again.
    // If one is not found, then `cat` the file and save it in the commit
    // cache.
    fileList: Map<string, {fileInfo: FileInfo}>,
  }>,
  tags?: Array<{
    name: string,
    sha: string,
    fileList: Map<string, {fileInfo: FileInfo}>,
  }>,
  commits?: Map<string, {
    hash: string,
    // TODO: put cached files map in here. Save file as an object
    // so that it gets saved by reference.
    cachedFiles: Map<string, FileInfo>,
    message: string,
    isMerge: boolean,
    author: string,
    date: Date,
    parent: string | null,
    diffs: Array<{
      fileName: string,
      lineNumber: number,
      beforeText: string,
      afterText: string,
    }>
  }>,
}

export type SortedFileList = Array<{
After
25
26
27








28
29
30
31
32
33
34
35
36


37
38


39
40
41
    // the function so that we don't have to compute it again.
    // If one is not found, then `cat` the file and save it in the commit
    // cache.
⁣
⁣
⁣
⁣
⁣
⁣
⁣
⁣
    // The FileInfo needs to know which commit it is looking at, then, in order
    // to query for the file contents or to search around the existing file list
    // to see if a copy is already available.
    fileList: Map<string, {fileInfo: FileInfo}>,
    commits: Array<Commit>,
  }>,
  tags?: Array<{
    name: string,
    sha: string,
⁣
⁣
    fileList: Map<string, {fileInfo: FileInfo}>,
  }>,
⁣
⁣
  commits?: Map<string, Commit>,
}

export type SortedFileList = Array<{
wiki/index.md:51
Before
50
51
52
53



54
  - branch snapshots
  - tag snapshots
  - commit snapshots (i.e. when they are mentioned in a blog post)

⁣
⁣
⁣
### Completed
After
50
51
52
53
54
55
56
57
  - branch snapshots
  - tag snapshots
  - commit snapshots (i.e. when they are mentioned in a blog post)
- [ ] this is not finding commit `b30bd9fa7e0bc1ed9e557769a79dcff79458c83d` in the `file-caching` branch. Why?
  - It's because commits need to be allowed to have different parents on different
    branches

### Completed