| ... | @@ -51,6 +51,8 @@ const RawMergeRequestSchema = Schema.Struct({ | ... | @@ -51,6 +51,8 @@ const RawMergeRequestSchema = Schema.Struct({ |
| 51 | author: Schema.optional(Schema.NullOr(RawUserSchema)), | 51 | author: Schema.optional(Schema.NullOr(RawUserSchema)), |
| 52 | source_branch: Schema.String, | 52 | source_branch: Schema.String, |
| 53 | target_branch: Schema.String, | 53 | target_branch: Schema.String, |
| | 54 | /** The source branch's head commit. */ |
| | 55 | sha: Schema.optional(Schema.NullOr(Schema.String)), |
| 54 | state: Schema.optional(Schema.NullOr(Schema.String)), | 56 | state: Schema.optional(Schema.NullOr(Schema.String)), |
| 55 | draft: Schema.optional(Schema.Boolean), | 57 | draft: Schema.optional(Schema.Boolean), |
| 56 | work_in_progress: Schema.optional(Schema.Boolean), | 58 | work_in_progress: Schema.optional(Schema.Boolean), |
| ... | @@ -240,6 +242,8 @@ export interface GitLabMergeRequestDetail extends GitLabMergeRequestListItem { | ... | @@ -240,6 +242,8 @@ export interface GitLabMergeRequestDetail extends GitLabMergeRequestListItem { |
| 240 | * it: an install too old to answer must not be read as saying the branch is current. | 242 | * it: an install too old to answer must not be read as saying the branch is current. |
| 241 | */ | 243 | */ |
| 242 | readonly divergedCommits?: number; | 244 | readonly divergedCommits?: number; |
| | 245 | /** Absent where GitLab did not report the head commit. */ |
| | 246 | readonly headSha?: string; |
| 243 | } | 247 | } |
| 244 | | 248 | |
| 245 | function trimmed(value: string | null | undefined): string | null { | 249 | function trimmed(value: string | null | undefined): string | null { |
| ... | @@ -365,6 +369,7 @@ function toListItem( | ... | @@ -365,6 +369,7 @@ function toListItem( |
| 365 | | 369 | |
| 366 | function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLabMergeRequestDetail { | 370 | function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLabMergeRequestDetail { |
| 367 | const listItem = toListItem(raw); | 371 | const listItem = toListItem(raw); |
| | 372 | const headSha = trimmed(raw.sha); |
| 368 | const autoMerge = | 373 | const autoMerge = |
| 369 | raw.merge_when_pipeline_succeeds == null && raw.auto_merge_enabled == null | 374 | raw.merge_when_pipeline_succeeds == null && raw.auto_merge_enabled == null |
| 370 | ? undefined | 375 | ? undefined |
| ... | @@ -390,6 +395,7 @@ function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLab | ... | @@ -390,6 +395,7 @@ function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLab |
| 390 | ? { autoMergeMethod: "squash" as const } | 395 | ? { autoMergeMethod: "squash" as const } |
| 391 | : {}), | 396 | : {}), |
| 392 | ...(raw.diverged_commits_count == null ? {} : { divergedCommits: raw.diverged_commits_count }), | 397 | ...(raw.diverged_commits_count == null ? {} : { divergedCommits: raw.diverged_commits_count }), |
| | 398 | ...(headSha === null ? {} : { headSha }), |
| 393 | }; | 399 | }; |
| 394 | } | 400 | } |
| 395 | | 401 | |