Add commit description parsing to git backends#46
Merged
Conversation
Commit messages consist of a subject (first line) and an optional body (everything after the first blank line). Previously only the subject was captured. This change stores the body in a dedicated `description` column so it is available alongside the subject for downstream use. Changes: - Add `Description` field to the `Commit` struct - Native git parser: extend format string with `%b%nGITANALYTICS_ENDMETA` and collect body lines until the end marker - Go-git parser: split `c.Message` on `\n\n` to separate subject from body - Schema: add `description TEXT NOT NULL DEFAULT ''` to commits table DDL - Store Init(): run `ALTER TABLE commits ADD COLUMN description ...` to migrate existing databases (no-op if the column already exists) - InsertCommits(): include description in the INSERT statement - Tests: add `initTestRepoWithDesc` helper and description assertion tests for both the native and go-git implementations https://claude.ai/code/session_01HJ7FLDkYneKyCiTtGHoRQ8
Owner
Author
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
This PR adds support for parsing and storing commit message descriptions (body text) in addition to subject lines across both git backends (go-git and native git). The description is now extracted, stored in the database, and available for analysis.
Key Changes
Commitstruct with aDescriptionfield to store the commit message body (text after the first blank line)%b) and added an end marker (GITANALYTICS_ENDMETA) for reliable parsing of multi-line descriptionsdescriptioncolumn to thecommitstable with a migration inInit()to support existing databasesTestGoGitDescriptionandTestNativeDescription) with a shared helper function (initTestRepoWithDesc) that creates test repositories with both subject-only and subject+description commitsImplementation Details
\n\n(blank line separator)GITANALYTICS_ENDMETAas a sentinel to reliably detect the end of the description body in the git log outputhttps://claude.ai/code/session_01HJ7FLDkYneKyCiTtGHoRQ8