This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

knotserver/xrpc: expose merge base in repo.compare responses

Signed-off-by: dawn <dawn@tangled.org>

author
dawn
date (Jul 18, 2026, 5:59 PM +0300) commit 4cadfdc3 parent 73a00493 change-id lqovtuok
+9 -6
+8 -6
knotserver/xrpc/repo_compare.go
··· 74 74 75 75 var combinedPatch []*gitdiff.File 76 76 var combinedPatchRaw string 77 - // we need the combined patch 78 - if len(formatPatch) >= 2 { 79 - mergeBaseCommit, err := gr.MergeBase(commit1, commit2) 80 - if err != nil { 81 - x.Logger.Error("error comparing revisions", "msg", err.Error()) 82 - } else { 77 + var mergeBase string 78 + if mergeBaseCommit, err := gr.MergeBase(commit1, commit2); err != nil { 79 + x.Logger.Error("error finding merge base", "msg", err.Error()) 80 + } else { 81 + mergeBase = mergeBaseCommit.Hash.String() 82 + // nothing to combine with fewer than two patches 83 + if len(formatPatch) >= 2 { 83 84 diffTree, err := gr.DiffTree(mergeBaseCommit, commit2) 84 85 if err != nil { 85 86 x.Logger.Error("error comparing revisions", "msg", err.Error()) ··· 93 94 response := types.RepoFormatPatchResponse{ 94 95 Rev1: commit1.Hash.String(), 95 96 Rev2: commit2.Hash.String(), 97 + MergeBase: mergeBase, 96 98 FormatPatch: formatPatch, 97 99 FormatPatchRaw: rawPatch, 98 100 CombinedPatch: combinedPatch,
+1
types/repo.go
··· 32 32 type RepoFormatPatchResponse struct { 33 33 Rev1 string `json:"rev1,omitempty"` 34 34 Rev2 string `json:"rev2,omitempty"` 35 + MergeBase string `json:"merge_base,omitempty"` 35 36 FormatPatch []FormatPatch `json:"format_patch,omitempty"` 36 37 FormatPatchRaw string `json:"patch,omitempty"` 37 38 CombinedPatch []*gitdiff.File `json:"combined_patch,omitempty"`