Monorepo for Tangled tangled.org
2

Configure Feed

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

knotserver: pass changedFiles in refUpdate events

Signed-off-by: Seongmin Lee <git@boltless.me>

author
Seongmin Lee
date (Jun 20, 2026, 7:50 PM +0900) commit 0cb1892d parent 235548f6 change-id xluwkuml
+23 -13
+23 -13
knotserver/internal.go
··· 242 242 // non-fatal 243 243 } 244 244 245 - // extract any push options 246 - pushOptionsRaw := r.Header.Values("X-Git-Push-Option") 247 - pushOptions := PushOptions{} 248 - for _, option := range pushOptionsRaw { 249 - if option == "skip-ci" || option == "ci-skip" { 250 - pushOptions.skipCi = true 251 - } 252 - if option == "verbose-ci" || option == "ci-verbose" { 253 - pushOptions.verboseCi = true 254 - } 245 + // extract max 50 push options 246 + pushOptions := r.Header.Values("X-Git-Push-Option") 247 + if len(pushOptions) > 50 { 248 + pushOptions = pushOptions[:50] 255 249 } 256 250 257 251 resp := hook.HookResponse{ ··· 259 253 } 260 254 261 255 for _, line := range lines { 262 - err := h.insertRefUpdate(line, gitUserDid, ownerDid, repoDid) 256 + err := h.insertRefUpdate(line, gitUserDid, ownerDid, repoDid, pushOptions) 263 257 if err != nil { 264 258 l.Error("failed to insert op", "err", err, "line", line, "did", gitUserDid, "repo", gitRelativeDir) 265 259 } ··· 278 272 writeJSON(w, resp) 279 273 } 280 274 281 - func (h *InternalHandle) insertRefUpdate(line git.PostReceiveLine, gitUserDid, ownerDid, repoDid string) error { 275 + func (h *InternalHandle) insertRefUpdate(line git.PostReceiveLine, gitUserDid, ownerDid, repoDid string, pushOptions []string) error { 282 276 refUpdate := tangled.GitRefUpdate{ 283 277 OldSha: line.OldSha.String(), 284 278 NewSha: line.NewSha.String(), ··· 287 281 OwnerDid: &ownerDid, 288 282 Repo: repoDid, 289 283 Meta: nil, 284 + PushOptions: pushOptions, 290 285 } 291 286 292 287 if !line.NewSha.IsZero() { ··· 299 294 if err != nil { 300 295 return fmt.Errorf("failed to open git repo at ref %s: %w", line.Ref, err) 301 296 } 297 + 298 + changedFiles, err := gr.ChangedFilesBetween(line.OldSha.String(), line.NewSha.String()) 299 + if err != nil { 300 + return fmt.Errorf("failed to get ref update changed files: %w", err) 301 + } 302 + refUpdate.ChangedFiles = changedFiles 302 303 303 304 meta, err := gr.RefUpdateMeta(line) 304 305 if err != nil { ··· 330 331 ownerDid string, 331 332 repoName string, 332 333 repoDid string, 333 - pushOptions PushOptions, 334 + pushOptionsRaw []string, 334 335 ) error { 336 + var pushOptions PushOptions 337 + for _, option := range pushOptionsRaw { 338 + if option == "skip-ci" || option == "ci-skip" { 339 + pushOptions.skipCi = true 340 + } 341 + if option == "verbose-ci" || option == "ci-verbose" { 342 + pushOptions.verboseCi = true 343 + } 344 + } 335 345 if pushOptions.skipCi { 336 346 return nil 337 347 }