Skip to content

feat(backend): parse and fetch single-commit metadata (#2090) - #2113

Draft
felipebergamin wants to merge 3 commits into
kernelci:mainfrom
profusion:feat/2090/commit-metadata-fetch
Draft

felipebergamin wants to merge 3 commits into
kernelci:mainfrom
profusion:feat/2090/commit-metadata-fetch

Conversation

@felipebergamin

Copy link
Copy Markdown
Member

Summary

  • SHA-only library: (hash, url?) → commit metadata or a typed error. No DB writes.
  • parse_commit / parse_commit_object work on an existing repo path so the mirrored-tree sync job ([#2079] Sync mirrored trees into commits #2109) can reuse parsing.
  • One-shot fetch uses a throwaway bare repo on 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.
  • If no URL is passed, pick one from checkouts (prefer maestro / git.kernel.org). Malformed URLs do not crash.

Stacked on #2106 (commits / commit_parents schema). This is not the fill path for commits.

Closes #2090

Test plan

  • pytest backend/kernelCI_app/tests/unitTests/helpers/gitCommit_test.py -n0 --reruns 0
  • Fixture parse: author, committer, subject, ordered parents (first parent first)
  • Parse against a pre-existing repo path with no git fetch
  • Fetch failure, oversized / full pack, and bad URL raise typed errors and wipe the scratch repo

alanpeixinho and others added 3 commits September 9, 2026 16:43
* 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>
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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#2079] Fetch commit metadata via SHA-only partial clone on tmpfs

2 participants