How zx2c4/cgit works
cgit is a CGI-based web interface for browsing Git repositories, with a built-in response cache. The principal workflow is an HTTP request entering the CGI handler, being resolved to a repository and page command, then rendered as a Git view and returned to the client; cache hits may serve a stored response. The README documents repository listing, history and source views, statistics, snapshots, and clone access. Some route and integration details are inferred only from the source index, so uncertain links are omitted.
Main entry points: cmd.c Page dispatch · ui-shared.c Shared UI helpers · cgit.c CGI handler · ui-log.c Commit history
Components 28
Request and cache
- CGI handler
cgit.c - Page dispatch
cmd.c - Response cache
cache.c
Repository discovery
- Runtime configuration
configfile.c - Repository scan
scan-tree.c
Repository browsing
- Repository index
ui-repolist.c - Repository summary
ui-summary.c - Refs and tags
ui-refs.c - Commit history
ui-log.c - Commit details
ui-commit.c - Diff view
ui-diff.c - Side-by-side diff
ui-ssdiff.c - Tree browser
ui-tree.c - Blob view
ui-blob.c - Blame view
ui-blame.c - Repository statistics
ui-stats.c - Source snapshots
ui-snapshot.c - Plain files
ui-plain.c - Clone access
ui-clone.c - Atom feed
ui-atom.c - Patch output
ui-patch.c
Rendering
- Shared UI helpers
ui-shared.c - HTML and HTTP output
html.c
Extensions
- Content filters
filter.c - Gravatar filter
filters/email-gravatar.py - Syntax highlighting
filters/syntax-highlighting.py
Other components
- Web client
- Git repositories
Connections 34
- Web client → CGI handler: sends request
README - CGI handler → Runtime configuration: reads settings
cgit.c - CGI handler → Response cache: checks cache
cgit.c - CGI handler → Repository scan: refreshes index
cgit.c - CGI handler → Page dispatch: dispatches page
cmd.c - Repository scan → Git repositories: scans paths
scan-tree.c - Page dispatch → Repository index: routes requests
cmd.c - Page dispatch → Repository summary: routes requests
cmd.c - Page dispatch → Refs and tags: routes requests
cmd.c - Page dispatch → Commit history: routes requests
cmd.c - Page dispatch → Commit details: routes requests
cmd.c - Page dispatch → Diff view: routes requests
cmd.c - Page dispatch → Tree browser: routes requests
cmd.c - Page dispatch → Blob view: routes requests
cmd.c - Page dispatch → Blame view: routes requests
cmd.c - Page dispatch → Repository statistics: routes requests
cmd.c - Page dispatch → Source snapshots: routes requests
cmd.c - Page dispatch → Plain files: routes requests
cmd.c - Page dispatch → Clone access: routes requests
cmd.c - Page dispatch → Atom feed: routes requests
cmd.c - Page dispatch → Patch output: routes requests
cmd.c - Diff view → Side-by-side diff: renders variant
ui-diff.c - Commit history → Commit details: links commits
ui-log.c - Tree browser → Blob view: links files
ui-tree.c - Repository index → Shared UI helpers: uses helpers
ui-repolist.c - Commit history → Shared UI helpers: uses helpers
ui-log.c - Diff view → Shared UI helpers: uses helpers
ui-diff.c - Tree browser → Shared UI helpers: uses helpers
ui-tree.c - Repository statistics → Shared UI helpers: uses helpers
ui-stats.c - Shared UI helpers → HTML and HTTP output: emits markup
ui-shared.c - Content filters → HTML and HTTP output: writes filtered output
filter.c - Gravatar filter → Content filters: optional filter
- Syntax highlighting → Content filters: optional filter
- Response cache → Web client: returns response
README