1"""A git branch or tag reference."""
2type GitRef
3@goModel(model: "github.com/git-bug/git-bug/api/graphql/models.GitRef") {
4 """Full reference name, e.g. refs/heads/main or refs/tags/v1.0."""
5 name: String!
6 """Short name, e.g. main or v1.0."""
7 shortName: String!
8 """Whether this reference is a branch or a tag."""
9 type: GitRefType!
10 """Commit hash the reference points to."""
11 hash: String!
12 """Git commit the reference points to."""
13 commit: GitCommit!
14}
15
16"""An entry in a git tree (directory listing)."""
17type GitTreeEntry
18@goModel(model: "github.com/git-bug/git-bug/api/graphql/models.GitTreeEntry") {
19 """File or directory name within the parent tree."""
20 name: String!
21 """Whether this entry is a file, directory, symlink, or submodule."""
22 type: GitObjectType! @goField(name: "ObjectType")
23 """Git object hash."""
24 hash: String!
25 """The last git commit that touched this tree entry. Null when the entry
26 cannot be resolved within the history depth limit."""
27 lastCommit: GitCommit
28}
29
30"""The content of a git blob (file)."""
31type GitBlob {
32 """Path of the file relative to the repository root."""
33 path: String!
34 """Git object hash. Can be used as a stable cache key or to construct a
35 raw download URL."""
36 hash: String!
37 """UTF-8 text content of the file. Null when isBinary is true or when
38 the file is too large to be returned inline (see isTruncated)."""
39 text: String
40 """Size in bytes."""
41 size: Int!
42 """True when the file contains null bytes and is treated as binary.
43 text will be null."""
44 isBinary: Boolean!
45 """True when the file exceeds the maximum inline size and text has been
46 omitted. Use the raw download endpoint to retrieve the full content."""
47 isTruncated: Boolean!
48}
49
50"""Metadata for a single git commit."""
51type GitCommit
52@goModel(model: "github.com/git-bug/git-bug/api/graphql/models.GitCommitMeta") {
53 """Full SHA-1 commit hash."""
54 hash: String!
55 """Abbreviated commit hash, typically 8 characters."""
56 shortHash: String!
57 """First line of the commit message."""
58 message: String!
59 """Full commit message."""
60 fullMessage: String!
61 """Name of the commit author."""
62 authorName: String!
63 """Email address of the commit author."""
64 authorEmail: String!
65 """Timestamp from the author field (when the change was originally made)."""
66 date: Time!
67 """Hashes of parent commits. Empty for the initial commit."""
68 parents: [String!]!
69 """Files changed relative to the first parent (or the empty tree for the
70 initial commit)."""
71 files(
72 """Returns the elements in the list that come after the specified cursor."""
73 after: String
74 """Returns the elements in the list that come before the specified cursor."""
75 before: String
76 """Returns the first _n_ elements from the list."""
77 first: Int
78 """Returns the last _n_ elements from the list."""
79 last: Int
80 ): GitChangedFileConnection!
81 """Unified diff for a single file in this commit."""
82 diff(path: String!): GitFileDiff
83}
84
85"""The last commit that touched each requested entry in a directory."""
86type GitLastCommit {
87 """Entry name within the directory."""
88 name: String!
89 """Most recent commit that modified this entry."""
90 commit: GitCommit!
91}
92
93# ── connection types ──────────────────────────────────────────────────────────
94
95type GitRefConnection {
96 nodes: [GitRef!]!
97 pageInfo: PageInfo!
98 totalCount: Int!
99}
100
101"""Paginated list of commits."""
102type GitCommitConnection {
103 nodes: [GitCommit!]!
104 pageInfo: PageInfo!
105 totalCount: Int!
106}
107
108type GitChangedFileConnection {
109 nodes: [GitChangedFile!]!
110 pageInfo: PageInfo!
111 totalCount: Int!
112}
113
114# ── commit sub-types ──────────────────────────────────────────────────────────
115
116"""A file that was changed in a commit."""
117type GitChangedFile
118@goModel(model: "github.com/git-bug/git-bug/repository.ChangedFile") {
119 """Path of the file in the new version of the commit."""
120 path: String!
121 """Previous path, non-null only for renames."""
122 oldPath: String
123 """How the file was affected by the commit."""
124 status: GitChangeStatus!
125}
126
127"""The diff for a single file in a commit."""
128type GitFileDiff
129@goModel(model: "github.com/git-bug/git-bug/repository.FileDiff") {
130 """Path of the file in the new version."""
131 path: String!
132 """Previous path, non-null only for renames."""
133 oldPath: String
134 """True when the file is binary and no textual diff is available."""
135 isBinary: Boolean!
136 """True when the file was created in this commit."""
137 isNew: Boolean!
138 """True when the file was deleted in this commit."""
139 isDelete: Boolean!
140 """Contiguous blocks of changes. Empty for binary files."""
141 hunks: [GitDiffHunk!]!
142}
143
144"""A contiguous block of changes in a unified diff."""
145type GitDiffHunk
146@goModel(model: "github.com/git-bug/git-bug/repository.DiffHunk") {
147 """Starting line number in the old file."""
148 oldStart: Int!
149 """Number of lines from the old file included in this hunk."""
150 oldLines: Int!
151 """Starting line number in the new file."""
152 newStart: Int!
153 """Number of lines from the new file included in this hunk."""
154 newLines: Int!
155 """Lines in this hunk, including context, additions, and deletions."""
156 lines: [GitDiffLine!]!
157}
158
159"""A single line in a unified diff hunk."""
160type GitDiffLine
161@goModel(model: "github.com/git-bug/git-bug/repository.DiffLine") {
162 """Whether this line is context, an addition, or a deletion."""
163 type: GitDiffLineType!
164 """Raw line content, without the leading +/- prefix."""
165 content: String!
166 """Line number in the old file. 0 for added lines."""
167 oldLine: Int!
168 """Line number in the new file. 0 for deleted lines."""
169 newLine: Int!
170}
171
172# ── enums ─────────────────────────────────────────────────────────────────────
173
174"""The kind of git reference: a branch, a tag, or a detached commit."""
175enum GitRefType
176@goModel(model: "github.com/git-bug/git-bug/repository.GitRefType") {
177 """A local branch (refs/heads/*)."""
178 BRANCH @goEnum(value: "github.com/git-bug/git-bug/repository.GitRefTypeBranch")
179 """An annotated or lightweight tag (refs/tags/*)."""
180 TAG @goEnum(value: "github.com/git-bug/git-bug/repository.GitRefTypeTag")
181 """A detached HEAD pointing directly at a commit."""
182 COMMIT @goEnum(value: "github.com/git-bug/git-bug/repository.GitRefTypeCommit")
183}
184
185"""The type of object a git tree entry points to."""
186enum GitObjectType
187@goModel(model: "github.com/git-bug/git-bug/repository.ObjectType") {
188 """A directory."""
189 TREE
190 """A regular or executable file."""
191 BLOB
192 """A symbolic link."""
193 SYMLINK
194 """A git submodule."""
195 SUBMODULE
196}
197
198"""How a file was affected by a commit."""
199enum GitChangeStatus
200@goModel(model: "github.com/git-bug/git-bug/repository.ChangeStatus") {
201 """File was created in this commit."""
202 ADDED
203 """File content changed in this commit."""
204 MODIFIED
205 """File was removed in this commit."""
206 DELETED
207 """File was moved or renamed in this commit."""
208 RENAMED
209}
210
211"""The role of a line within a unified diff hunk."""
212enum GitDiffLineType
213@goModel(model: "github.com/git-bug/git-bug/repository.DiffLineType") {
214 """An unchanged line present in both old and new versions."""
215 CONTEXT
216 """A line added in the new version."""
217 ADDED
218 """A line removed from the old version."""
219 DELETED
220}