feat(backend): parse and fetch single-commit metadata (#2090) - #2113
Draft
felipebergamin wants to merge 5 commits into
Draft
felipebergamin wants to merge 5 commits into
felipebergamin wants to merge 5 commits into
Conversation
* Add `Commits` model: unique `git_commit_hash`, nullable author/committer/subject/message/`fetched_from_url` * Add `CommitParents` model: FKs to `commits.id`, `ord` with 0 = first parent, unique `(commit_id, ord)` * Add migration `0021_commits_and_commit_parents` (`commits`, `commit_parents` tables and indexes) * Join from `checkouts.git_commit_hash` without new checkout columns Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
Dump commits and commit_parents in full so git ancestry survives restore. Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
…ci#2089) Keep commits rows narrow: unique git name/email in commit_identity, subject plus UTF-8 body in commit_message as bytea. update_db dumps and restores the new tables and still accepts a flat legacy commits CSV.
alanpeixinho
approved these changes
Sep 24, 2026
| """Read one commit from an existing repo. Does not fetch.""" | ||
| try: | ||
| full_hash = ( | ||
| _git( |
Contributor
There was a problem hiding this comment.
Have we considered using pygit2 or GitPython?
| kernel_org = "git.kernel.org" in host | ||
| maestro = origin == "maestro" | ||
| if maestro and kernel_org: | ||
| tier = 0 |
Contributor
There was a problem hiding this comment.
what exactly are those tiers?
Member
Author
There was a problem hiding this comment.
what exactly are those tiers?
They’re a priority rank for which checkout URL to use when a SHA has more than one git_repository_url.
I have updated the docstring to make this clearer and will update the docs/sync-commits.md in #2118
Add a SHA-only helper for commit author/parents so later sync can reuse parsing without duplicating git format handling. Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
- Move fetch timeout and max pack size to Django settings (GIT_FETCH_TIMEOUT_SECONDS, GIT_FETCH_MAX_PACK_BYTES) - Document URL preference tiers and why the git CLI is used - Reuse author/committer constants in tests
felipebergamin
force-pushed
the
feat/2090/commit-metadata-fetch
branch
from
September 25, 2026 20:39
acee39a to
a4fb0ae
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(hash, url?)→ commit metadata or a typed error. No DB writes.parse_commit/parse_commit_objectwork on an existing repo path so the mirrored-tree sync job ([#2079] Sync mirrored trees into commits #2109) can reuse parsing.GIT_SCRATCH_DIR(git fetch --no-tags --depth=1 --filter=tree:0), then wipes. Rejects oversized / treeful packs. Parent hashes come from the child object only.checkouts(prefer maestro / git.kernel.org). Malformed URLs do not crash.Stacked on #2106 (
commits/commit_parentsschema). This is not the fill path forcommits.Closes #2090
Test plan
pytest backend/kernelCI_app/tests/unitTests/helpers/gitCommit_test.py -n0 --reruns 0git fetch