Versions in this module Expand all Collapse all v0 v0.4.1 Aug 7, 2026 v0.4.0 Aug 7, 2026 Changes in this version + var COST_MAX = 65536 + var ErrNotPrOwner = fmt.Errorf("only the PR creator can perform this action") + var ErrPatchExists = errors.New("patch already exists for patch request") + var GITPR_VERSION = "2026.02.25" + var RANGE_DIFF_CREATION_FACTOR_DEFAULT = 60 + func AugmentCoverLetterPatch(rawText string, discussion string, cfgURL string, prID int64) string + func BuildDiscussion(events []*EventLog, users map[int64]*User) string + func GenerateCoverLetterPatch(pr *PatchRequest, discussion string, cfgURL string) string + func GenerateMboxWithCoverLetter(pr *PatchRequest, patches []*Patch, events []*EventLog, users map[int64]*User, ...) string + func GetAuthorizedKeys(pubkeys []string) ([]ssh.PublicKey, error) + func GitPatchRequestMiddleware(be *Backend, pr GitPatchRequest) pssh.SSHServerMiddleware + func GitSshServer(ctx context.Context, cfg *GitCfg) *pssh.SSHServer + func GitWebServer(cfg *GitCfg) http.Handler + func HasCoverLetter(patches []*Patch) bool + func LoadConfigFile(fpath string, logger *slog.Logger) + func NewCli(sesh *pssh.SSHServerConnSession, be *Backend, pr GitPatchRequest) *cli.App + func NewTabWriter(out io.Writer) *tabwriter.Writer + func ParsePatch(patchRaw string) ([]*gitdiff.File, string, error) + func RangeDiffToStr(diffs []*RangeDiffOutput) string + func SqliteOpen(dsn string, logger *slog.Logger) (*sqlx.DB, error) + func SupportsSemanticDiff(fileName string) bool + type Acl struct + CreatedAt time.Time + ID int64 + IpAddress sql.NullString + Permission string + Pubkey sql.NullString + type AllPatchData struct + Patches []PatchSummary + Patchsets []*PatchsetData + type Backend struct + Cfg *GitCfg + DB *sqlx.DB + Limiter *RateLimiter + Logger *slog.Logger + func (be *Backend) ComputeUserName(pubkey string) string + func (be *Backend) IsAdmin(pk ssh.PublicKey) bool + func (be *Backend) KeyForFingerprint(pk ssh.PublicKey) string + func (be *Backend) KeyForKeyText(pk ssh.PublicKey) string + func (be *Backend) KeysEqual(pka, pkb string) bool + func (be *Backend) Pubkey(pk ssh.PublicKey) string + func (be *Backend) PubkeyToPublicKey(pubkey string) (ssh.PublicKey, error) + func (be *Backend) PublicKeysEqual(a, b ssh.PublicKey) bool + type BasicData struct + type EventData struct + Comment string + Name string + Status Status + func (e *EventData) Scan(value any) error + func (e EventData) String() string + func (e EventData) Value() (driver.Value, error) + type EventLog struct + CreatedAt time.Time + Data EventData + Event string + ID int64 + PatchRequestID sql.NullInt64 + PatchsetID sql.NullInt64 + UserID int64 + type EventLogData struct + Date string + FormattedPatchsetID string + RangeDiff []*RangeDiffOutput + type GitCfg struct + Admins []ssh.PublicKey + AdminsStr []string + DataDir string + Desc string + Host string + Logger *slog.Logger + MaxStdinBytes int64 + PromPort string + RateLimitCount int + RateLimitInterval string + SshPort string + Theme string + TimeFormat string + Url string + WebPort string + func NewGitCfg(logger *slog.Logger) *GitCfg + type GitPatchRequest interface + CreateEventLog func(tx *sqlx.Tx, eventLog EventLog) error + DeletePatchsetByID func(userID, prID int64, patchsetID int64) error + DiffPatchsets func(aset *Patchset, bset *Patchset) ([]*RangeDiffOutput, error) + GetEventLogs func() ([]*EventLog, error) + GetEventLogsByPrID func(prID int64) ([]*EventLog, error) + GetEventLogsByUserID func(userID int64) ([]*EventLog, error) + GetLatestPatchsetByPrID func(prID int64) (*Patchset, error) + GetPatchRequestByID func(prID int64) (*PatchRequest, error) + GetPatchRequests func() ([]*PatchRequest, error) + GetPatchRequestsByPubkey func(pubkey string) ([]*PatchRequest, error) + GetPatchRequestsByRepoName func(repoName string) ([]*PatchRequest, error) + GetPatchesByPatchsetID func(patchsetID int64) ([]*Patch, error) + GetPatchsetByID func(patchsetID int64) (*Patchset, error) + GetPatchsetsByPrID func(prID int64) ([]*Patchset, error) + GetUserByID func(userID int64) (*User, error) + GetUserByPubkey func(pubkey string) (*User, error) + GetUsers func() ([]*User, error) + IsBanned func(pubkey, ipAddress string) error + SubmitIssue func(userID int64, userPubkey string, repoName, title, body string) (*PatchRequest, error) + SubmitPatchRequest func(userID int64, userPubkey string, repoName string, patchset io.Reader) (*PatchRequest, error) + SubmitPatchset func(prID, userID int64, op PatchsetOp, patchset io.Reader) ([]*Patch, error) + UpdatePatchRequestName func(prID int64, userPubkey string, name string) error + UpdatePatchRequestStatus func(prID int64, userPubkey string, status Status, comment string) error + UpsertUserByPubkey func(pubkey string) (*User, error) + type MetaData struct + Desc template.HTML + Tab TabStatus + URL string + type Patch struct + AuthorDate time.Time + AuthorEmail string + AuthorName string + BaseCommitSha sql.NullString + Body string + BodyAppendix string + CommitSha string + ContentSha string + CreatedAt time.Time + Files []*gitdiff.File + ID int64 + PatchsetID int64 + RawText string + Title string + UserID int64 + func ParsePatchset(patchset io.Reader) ([]*Patch, error) + func (p *Patch) CalcDiff() string + type PatchData struct + FormattedAuthorDate string + PatchFiles []*PatchFile + PatchHeader *gitdiff.PatchHeader + SemanticSummary SemanticSummary + Url template.URL + type PatchFile struct + Adds int64 + Dels int64 + DisplayName string + FileAnchor string + Hunks []PatchHunk + SemanticChanges []SemanticChange + type PatchHunk struct + Anchor string + DiffText template.HTML + type PatchRequest struct + CreatedAt time.Time + ID int64 + LastActivity time.Time + Name string + RepoName string + Status Status + Text string + UpdatedAt time.Time + UserID int64 + type PatchSummary struct + FormattedAuthorDate string + Url template.URL + type Patchset struct + CreatedAt time.Time + ID int64 + PatchRequestID int64 + Review bool + UserID int64 + type PatchsetData struct + Date string + FormattedID string + RangeDiff []*RangeDiffOutput + type PatchsetOp int + const OpNormal + type PrCmd struct + Backend *Backend + func (cmd PrCmd) CreateEventLog(tx *sqlx.Tx, eventLog EventLog) error + func (cmd PrCmd) DeletePatchsetByID(userID int64, prID int64, patchsetID int64) error + func (cmd PrCmd) DiffPatchsets(prev *Patchset, next *Patchset) ([]*RangeDiffOutput, error) + func (cmd PrCmd) GetEventLogs() ([]*EventLog, error) + func (cmd PrCmd) GetEventLogsByPrID(prID int64) ([]*EventLog, error) + func (cmd PrCmd) GetEventLogsByUserID(userID int64) ([]*EventLog, error) + func (cmd PrCmd) GetPatchRequestByID(prID int64) (*PatchRequest, error) + func (cmd PrCmd) GetPatchRequests() ([]*PatchRequest, error) + func (cmd PrCmd) GetPatchRequestsActive() ([]*PatchRequest, error) + func (cmd PrCmd) GetPatchRequestsByPubkey(pubkey string) ([]*PatchRequest, error) + func (cmd PrCmd) GetPatchRequestsByRepoName(repoName string) ([]*PatchRequest, error) + func (cmd PrCmd) GetPatchRequestsByStatus(status Status) ([]*PatchRequest, error) + func (cmd PrCmd) GetPatchRequestsInactive() ([]*PatchRequest, error) + func (cmd PrCmd) SubmitIssue(userID int64, userPubkey string, repoName, title, body string) (*PatchRequest, error) + func (cmd PrCmd) SubmitPatchRequest(userID int64, userPubkey string, repoName string, patchset io.Reader) (*PatchRequest, error) + func (cmd PrCmd) SubmitPatchset(prID int64, userID int64, op PatchsetOp, patchset io.Reader) ([]*Patch, error) + func (cmd PrCmd) UpdatePatchRequestName(prID int64, userPubkey string, name string) error + func (cmd PrCmd) UpdatePatchRequestStatus(prID int64, userPubkey string, status Status, comment string) error + func (pr PrCmd) GetLatestPatchsetByPrID(prID int64) (*Patchset, error) + func (pr PrCmd) GetPatchesByPatchsetID(patchsetID int64) ([]*Patch, error) + func (pr PrCmd) GetPatchsetByID(patchsetID int64) (*Patchset, error) + func (pr PrCmd) GetPatchsetsByPrID(prID int64) ([]*Patchset, error) + func (pr PrCmd) GetUserByID(id int64) (*User, error) + func (pr PrCmd) GetUserByPubkey(pubkey string) (*User, error) + func (pr PrCmd) GetUsers() ([]*User, error) + func (pr PrCmd) IsBanned(pubkey, ipAddress string) error + func (pr PrCmd) UpsertUserByPubkey(pubkey string) (*User, error) + type PrData struct + Date string + ID int64 + Status Status + Title string + type PrDetailData struct + Branch string + FormattedPatchsetID string + Logs []EventLogData + NextUrl string + Page string + Patch *PatchData + Patches []PatchSummary + Patchset *Patchset + PatchsetDate string + Pr PrData + PrevUrl string + RepoName string + type PrListData struct + PRs []PrListItem + type PrListItem struct + FormattedDate string + ID int64 + Name string + NumPatchsets int + RepoName string + Status Status + type RangeDiffFile struct + NewName string + OldName string + Type string + type RangeDiffHeader struct + AuthorChanged bool + BodyChanged bool + ContentEqual bool + NewAuthorEmail string + NewAuthorName string + NewBody string + NewIdx int + NewSha string + NewTitle string + OldAuthorEmail string + OldAuthorName string + OldBody string + OldIdx int + OldSha string + OldTitle string + Title string + TitleChanged bool + func NewRangeDiffHeader(a, b *Patch, aIndex, bIndex int) *RangeDiffHeader + func (hdr *RangeDiffHeader) String() string + type RangeDiffOutput struct + Files []*RangeDiffFile + Header *RangeDiffHeader + Order int + Type string + func RangeDiff(a []*Patch, b []*Patch) []*RangeDiffOutput + type RateLimiter struct + func NewRateLimiter(max int, interval time.Duration) *RateLimiter + func (r *RateLimiter) Allow() bool + func (r *RateLimiter) Error() error + type SemanticChange struct + EntityKind string + HunkAnchor string + HunkIndex int + Kind SemanticChangeKind + Name string + NewSig string + OldSig string + func AnalyzeSemanticChanges(file *gitdiff.File) []SemanticChange + type SemanticChangeKind string + const SemanticAdded + const SemanticModified + const SemanticRemoved + const SemanticRenamed + const SemanticSignatureChanged + type SemanticSummary struct + Added int + AnalyzedFileCount int + Modified int + Removed int + SignatureChanged int + SkippedFiles []string + func SummarizeSemanticChanges(summary SemanticSummary, fileName string, supported bool, ...) SemanticSummary + func (s SemanticSummary) HasContent() bool + func (s SemanticSummary) Total() int + type Status string + const StatusDraft + const StatusOpen + type TabStatus string + const TabStatusActive + const TabStatusDraft + const TabStatusInactive + type User struct + CreatedAt time.Time + ID int64 + Name string + Pubkey string + UpdatedAt time.Time + type UserData struct + CreatedAt string + IsAdmin bool + Name string + Pubkey string + UserID int64 + type WebCtx struct + Backend *Backend + Formatter *formatterHtml.Formatter + Logger *slog.Logger + Pr *PrCmd + Theme *chroma.Style