Skip to main content

Parser for git log --raw

Project description

glrp - git-log-raw-parser

A parser for parsing the command:

git log -p --format=raw --show-signature --stat

Why?

The above command provides a lot of useful information about git commits, which we can analyze, including:

  • Commit message
  • Diffs
  • Author name and email
  • Committer name and email
  • Timestamps
  • GPG signature

On its own, git log does not output its information in a format which is easy for other programs to use. So, this tool parses the output and turns it into JSON which is more easy to analyze and check.

Installation

pipx install glrp

Usage

Using it is simple, just run the git log command and pipe it to the standard input of git_log_raw_parser

git log -p --format=raw --show-signature --stat | python3 -m glrp --output-dir=./out/

Or perhaps a bit more realistic:

git clone https://github.com/cfengine/core
(cd core && git log -p --format=raw --show-signature --stat HEAD~500..HEAD 2>/dev/null) | python3 git_log_raw_parser.py

(Clone CFEngine core, start subshell which enters the subdirectory and runs git log for the past 500 commits).

Important notes

Warning: The output of --show-signature varies depending on which keys you have imported / trusted in your installation of GPG. Make sure you import the correct GPG keys beforehand, and don't expect output to be identical across different machines with different GPG states.

Warning: Consider this a best-effort, "lossy" parsing. Commits may contain non utf-8 characters, to avoid "crashing", we skip these, replacing them with question marks. Thus, the parsing is lossy, don't expect all the information to be there. This tool can be used for searching / analyzing commits, but don't use it as some kind of backup tool where you expect to have the ability to "reconstruct" the commits and repo entirely.

Details

For details on how the parsing works, try running with --debug and look at the resulting ./debug/ folder. Also, see the comments in the source code; ./git_log_raw_parser.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glrp-0.0.2.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glrp-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file glrp-0.0.2.tar.gz.

File metadata

  • Download URL: glrp-0.0.2.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for glrp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 87999d59ed26a7dbba91191c5c9f2789564d642ef4e408650cac94fd9d8d2289
MD5 459ec60213a0737ef14af72557115c13
BLAKE2b-256 3c082a45cbd2c145180aa124421675dad646ba5de70383211db6579b1dd293ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for glrp-0.0.2.tar.gz:

Publisher: python-publish.yml on olehermanse/glrp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file glrp-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: glrp-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for glrp-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 766ffb607334446365ce4d76ba14a157661508a33c8289c17c587e671c158aba
MD5 88df05d88728a5e7023e044dffea7250
BLAKE2b-256 4a90b72ae0d5ab4f34cd52edc133f147ffc57be266b1d1e9d94a5b4d5327bd60

See more details on using hashes here.

Provenance

The following attestation bundles were made for glrp-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on olehermanse/glrp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page