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