Skip to content

Commit 5dea562

Browse files
committed
Add git_evtag_py
1 parent af53652 commit 5dea562

File tree

9 files changed

+1327
-0
lines changed

9 files changed

+1327
-0
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: main
6+
paths-ignore:
7+
- '.gitignore'
8+
- 'LICENSE'
9+
- 'README.md'
10+
pull_request:
11+
branches: main
12+
paths-ignore:
13+
- '.gitignore'
14+
- 'LICENSE'
15+
- 'README.md'
16+
workflow_dispatch:
17+
18+
jobs:
19+
ci:
20+
permissions:
21+
contents: read
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 30
24+
concurrency:
25+
group: ci-${{ matrix.platform }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
steps:
28+
# 4.2.2
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
30+
with:
31+
persist-credentials: false
32+
33+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
34+
35+
- name: Install uv
36+
# 5.4.0
37+
uses: astral-sh/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174
38+
with:
39+
version: "0.7.5"
40+
enable-cache: true
41+
cache-dependency-glob: |
42+
**/uv.lock
43+
**/pyproject.toml
44+
45+
- name: Install dependencies
46+
run: |
47+
sudo apt-get update && sudo apt-get install -y \
48+
--no-install-recommends git
49+
50+
- name: Install python dependencies
51+
run: uv sync -v --all-groups --frozen
52+
53+
- name: Check code formatting
54+
run: uv run ruff format --check
55+
56+
- name: Lint
57+
run: uv run ruff check --output-format=github
58+
59+
- name: Check python types
60+
run: uv run mypy .

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__pycache__
2+
.mypy_cache
3+
.ruff_cache
4+
venv
5+
.venv

.pre-commit-config.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
default_stages:
4+
- pre-commit
5+
fail_fast: true
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: check-added-large-files
13+
args: ['--maxkb=100']
14+
- id: check-shebang-scripts-are-executable
15+
- id: check-executables-have-shebangs
16+
- id: check-symlinks
17+
- id: mixed-line-ending
18+
args: [--fix=lf]
19+
20+
- repo: local
21+
hooks:
22+
- id: uv-lock
23+
name: uv lock
24+
description: Sync uv lock
25+
entry: uv lock --quiet
26+
language: python
27+
pass_filenames: false
28+
- id: ruff-format
29+
name: ruff format
30+
description: Format with ruff
31+
entry: uv run --frozen -q ruff format
32+
language: system
33+
pass_filenames: false
34+
- id: ruff-check
35+
name: ruff
36+
description: Lint with ruff
37+
entry: uv run --frozen -q ruff check --fix --exit-non-zero-on-fix
38+
language: system
39+
pass_filenames: false
40+
- id: mypy-check
41+
name: mypy
42+
description: Check types with mypy
43+
entry: uv run --frozen -q mypy .
44+
language: system
45+
pass_filenames: false
46+
files: \.py$

LICENSE

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### git_evtag_py
2+
3+
A python script version of [git-evtag](https://github.com/cgwalters/git-evtag/),
4+
inspired by the [upstream Python implementation](https://github.com/cgwalters/git-evtag/blob/7c58b2021a066f1e552deeb37431bc70b6215d62/src/git-evtag-compute-py) but more feature complete and faster.
5+
6+
This can,
7+
8+
- Calculate and show checksum
9+
- Verify checksum of a tag against the one in the tag message
10+
- Sign a tag with the checksum
11+
12+
13+
### Usage
14+
15+
Install `git`.
16+
17+
Symlink `git-evtag` to `~/.local/bin/git-evtag` or somewhere else that is in
18+
`$PATH`. Then,
19+
20+
```sh
21+
$ git evtag -h
22+
usage: git-evtag [-h] [--rev REV] [--repo REPO] [--verify VERIFY] [--sign SIGN] [--compat]
23+
24+
Tree checksum of a git repository
25+
26+
options:
27+
-h, --help show this help message and exit
28+
--rev REV Git revision (default: HEAD)
29+
--repo REPO Path to the git repository (default: current dir)
30+
--verify VERIFY Verify the tree checksum from the input tag message
31+
--sign SIGN Sign the input tag with the tree checksum
32+
--compat Produce 'git-evtag' upstream output
33+
34+
```
35+
36+
### Development
37+
38+
```sh
39+
uv run ruff format
40+
uv run ruff check --fix --exit-non-zero-on-fix
41+
uv run mypy .
42+
```

git-evtag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
git_evtag_py.py

0 commit comments

Comments
 (0)