{{ define "repo/pulls/fragments/pullStepReview" }} {{ $root := . }} {{ $params := .StepReviewParams }}
{{ if not $params }}
{{ if eq $root.Source "patch" }} Paste a patch above to see a comparison. {{ else }} Pick a source and target above to see a comparison. {{ end }}
{{ else if eq .Source "patch" }} {{ else }} {{ if $params.Commits }} {{ $commits := $params.Commits }}
{{ len $commits }} commit{{ if ne (len $commits) 1 }}s{{ end }} {{ if and $root.SourceBranch $root.TargetBranch }} {{ $root.TargetBranch }} {{ i "arrow-left-right" "w-4 h-4 flex-shrink-0" }} {{ $root.SourceBranch }} {{ end }}
{{ template "pullReviewCommits" (list $root.SourceRepo $params.Commits) }}
Loading...
{{ else }}
{{ if and .SourceBranch .TargetBranch (eq .SourceBranch .TargetBranch) }} Source and target are the same branch, nothing to merge. {{ else }} No commits between target and source. Make sure your source branch has commits not on the target. {{ end }}
{{ end }} {{ end }}
{{ end }} {{ define "pullReviewCommits" }} {{ $sourceRepo := index . 0 }} {{ $commits := index . 1 }} {{ end }} {{ define "pullComposeFlatDiff" }} {{ $diff := index . 0 }} {{ $opts := index . 1 }} {{ $files := $diff.ChangedFiles }} {{ $isSplit := $opts.Split }} {{ $count := len $files }} {{ $stat := $diff.Stats }}
{{ template "repo/fragments/diffStatPill" $stat }}
{{ template "repo/fragments/diffOpts" $opts }}
{{ if eq $count 0 }}

No differences found.

{{ else if le $count 5 }} {{ range $idx, $file := $files }} {{ template "diffFile" (list $idx $file $isSplit true) }} {{ end }} {{ else }} {{ range $idx, $file := slice $files 0 5 }} {{ template "diffFile" (list $idx $file $isSplit true) }} {{ end }} {{ $remaining := sub $count 5 }}
{{ i "chevron-right" "w-4 h-4" }} Show {{ $remaining }} more file{{ if ne $remaining 1 }}s{{ end }}
{{ range $idx, $file := slice $files 5 }} {{ template "diffFile" (list (add $idx 5) $file $isSplit true) }} {{ end }}
{{ end }}
{{ end }}