githead 1.2.2__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- githead-2.0.0/.gitignore +502 -0
- githead-1.2.2/LICENSE → githead-2.0.0/LICENSE.md +3 -1
- githead-2.0.0/PKG-INFO +63 -0
- githead-2.0.0/README.md +39 -0
- githead-2.0.0/githead/__init__.py +59 -0
- githead-2.0.0/pyproject.toml +59 -0
- githead-2.0.0/pytest.toml +1 -0
- githead-2.0.0/tests/test___init__.py +41 -0
- githead-1.2.2/.envrc +0 -3
- githead-1.2.2/.gitattributes +0 -2
- githead-1.2.2/.github/workflows/workflow.yaml +0 -100
- githead-1.2.2/.gitignore +0 -218
- githead-1.2.2/.vscode/settings.json +0 -7
- githead-1.2.2/PKG-INFO +0 -47
- githead-1.2.2/README.md +0 -24
- githead-1.2.2/githead/__init__.py +0 -33
- githead-1.2.2/pyproject.toml +0 -153
- githead-1.2.2/shell.nix +0 -48
- githead-1.2.2/tests/test___init__.py +0 -38
- githead-1.2.2/uv.lock +0 -118
- {githead-1.2.2 → githead-2.0.0}/githead/py.typed +0 -0
- {githead-1.2.2 → githead-2.0.0}/tests/git/refs/foo +0 -0
githead-2.0.0/.gitignore
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
|
|
2
|
+
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
|
|
3
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
|
|
4
|
+
|
|
5
|
+
### C ###
|
|
6
|
+
# Prerequisites
|
|
7
|
+
*.d
|
|
8
|
+
|
|
9
|
+
# Object files
|
|
10
|
+
*.o
|
|
11
|
+
*.ko
|
|
12
|
+
*.obj
|
|
13
|
+
*.elf
|
|
14
|
+
|
|
15
|
+
# Linker output
|
|
16
|
+
*.ilk
|
|
17
|
+
*.map
|
|
18
|
+
*.exp
|
|
19
|
+
|
|
20
|
+
# Precompiled Headers
|
|
21
|
+
*.gch
|
|
22
|
+
*.pch
|
|
23
|
+
|
|
24
|
+
# Libraries
|
|
25
|
+
*.lib
|
|
26
|
+
*.a
|
|
27
|
+
*.la
|
|
28
|
+
*.lo
|
|
29
|
+
|
|
30
|
+
# Shared objects (inc. Windows DLLs)
|
|
31
|
+
*.dll
|
|
32
|
+
*.so
|
|
33
|
+
*.so.*
|
|
34
|
+
*.dylib
|
|
35
|
+
|
|
36
|
+
# Executables
|
|
37
|
+
*.exe
|
|
38
|
+
*.out
|
|
39
|
+
*.app
|
|
40
|
+
*.i*86
|
|
41
|
+
*.x86_64
|
|
42
|
+
*.hex
|
|
43
|
+
|
|
44
|
+
# Debug files
|
|
45
|
+
*.dSYM/
|
|
46
|
+
*.su
|
|
47
|
+
*.idb
|
|
48
|
+
*.pdb
|
|
49
|
+
|
|
50
|
+
# Kernel Module Compile Results
|
|
51
|
+
*.mod*
|
|
52
|
+
!h2corn/bench/grpc_client/go.mod
|
|
53
|
+
*.cmd
|
|
54
|
+
.tmp_versions/
|
|
55
|
+
modules.order
|
|
56
|
+
Module.symvers
|
|
57
|
+
Mkfile.old
|
|
58
|
+
dkms.conf
|
|
59
|
+
|
|
60
|
+
### CMake ###
|
|
61
|
+
CMakeLists.txt.user
|
|
62
|
+
CMakeCache.txt
|
|
63
|
+
CMakeFiles
|
|
64
|
+
CMakeScripts
|
|
65
|
+
Testing
|
|
66
|
+
Makefile
|
|
67
|
+
cmake_install.cmake
|
|
68
|
+
install_manifest.txt
|
|
69
|
+
compile_commands.json
|
|
70
|
+
CTestTestfile.cmake
|
|
71
|
+
_deps
|
|
72
|
+
|
|
73
|
+
### CMake Patch ###
|
|
74
|
+
CMakeUserPresets.json
|
|
75
|
+
|
|
76
|
+
# External projects
|
|
77
|
+
*-prefix/
|
|
78
|
+
|
|
79
|
+
### direnv ###
|
|
80
|
+
.direnv
|
|
81
|
+
.envrc
|
|
82
|
+
|
|
83
|
+
### dotenv ###
|
|
84
|
+
.env
|
|
85
|
+
|
|
86
|
+
### Linux ###
|
|
87
|
+
*~
|
|
88
|
+
|
|
89
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
90
|
+
.fuse_hidden*
|
|
91
|
+
|
|
92
|
+
# KDE directory preferences
|
|
93
|
+
.directory
|
|
94
|
+
|
|
95
|
+
# Linux trash folder which might appear on any partition or disk
|
|
96
|
+
.Trash-*
|
|
97
|
+
|
|
98
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
|
99
|
+
.nfs*
|
|
100
|
+
|
|
101
|
+
### Node ###
|
|
102
|
+
# Logs
|
|
103
|
+
logs
|
|
104
|
+
*.log
|
|
105
|
+
npm-debug.log*
|
|
106
|
+
yarn-debug.log*
|
|
107
|
+
yarn-error.log*
|
|
108
|
+
lerna-debug.log*
|
|
109
|
+
.pnpm-debug.log*
|
|
110
|
+
|
|
111
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
112
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
113
|
+
|
|
114
|
+
# Runtime data
|
|
115
|
+
pids
|
|
116
|
+
*.pid
|
|
117
|
+
*.seed
|
|
118
|
+
*.pid.lock
|
|
119
|
+
|
|
120
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
121
|
+
lib-cov
|
|
122
|
+
|
|
123
|
+
# Coverage directory used by tools like istanbul
|
|
124
|
+
/coverage/
|
|
125
|
+
*.lcov
|
|
126
|
+
|
|
127
|
+
# nyc test coverage
|
|
128
|
+
.nyc_output
|
|
129
|
+
|
|
130
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
131
|
+
.grunt
|
|
132
|
+
|
|
133
|
+
# Bower dependency directory (https://bower.io/)
|
|
134
|
+
bower_components
|
|
135
|
+
|
|
136
|
+
# node-waf configuration
|
|
137
|
+
.lock-wscript
|
|
138
|
+
|
|
139
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
140
|
+
build/Release
|
|
141
|
+
|
|
142
|
+
# Dependency directories
|
|
143
|
+
node_modules/
|
|
144
|
+
jspm_packages/
|
|
145
|
+
|
|
146
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
147
|
+
web_modules/
|
|
148
|
+
|
|
149
|
+
# TypeScript cache
|
|
150
|
+
*.tsbuildinfo
|
|
151
|
+
|
|
152
|
+
# Optional npm cache directory
|
|
153
|
+
.npm
|
|
154
|
+
|
|
155
|
+
# Optional eslint cache
|
|
156
|
+
.eslintcache
|
|
157
|
+
|
|
158
|
+
# Optional stylelint cache
|
|
159
|
+
.stylelintcache
|
|
160
|
+
|
|
161
|
+
# Microbundle cache
|
|
162
|
+
.rpt2_cache/
|
|
163
|
+
.rts2_cache_cjs/
|
|
164
|
+
.rts2_cache_es/
|
|
165
|
+
.rts2_cache_umd/
|
|
166
|
+
|
|
167
|
+
# Optional REPL history
|
|
168
|
+
.node_repl_history
|
|
169
|
+
|
|
170
|
+
# Output of 'npm pack'
|
|
171
|
+
*.tgz
|
|
172
|
+
|
|
173
|
+
# Yarn Integrity file
|
|
174
|
+
.yarn-integrity
|
|
175
|
+
|
|
176
|
+
# dotenv environment variable files
|
|
177
|
+
.env.development.local
|
|
178
|
+
.env.test.local
|
|
179
|
+
.env.production.local
|
|
180
|
+
.env.local
|
|
181
|
+
|
|
182
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
183
|
+
.cache
|
|
184
|
+
.parcel-cache
|
|
185
|
+
|
|
186
|
+
# Next.js build output
|
|
187
|
+
.next
|
|
188
|
+
out
|
|
189
|
+
|
|
190
|
+
# Nuxt.js build / generate output
|
|
191
|
+
.nuxt
|
|
192
|
+
dist
|
|
193
|
+
|
|
194
|
+
# Gatsby files
|
|
195
|
+
.cache/
|
|
196
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
197
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
198
|
+
# public
|
|
199
|
+
|
|
200
|
+
# vuepress build output
|
|
201
|
+
.vuepress/dist
|
|
202
|
+
|
|
203
|
+
# vuepress v2.x temp and cache directory
|
|
204
|
+
.temp
|
|
205
|
+
|
|
206
|
+
# Docusaurus cache and generated files
|
|
207
|
+
.docusaurus
|
|
208
|
+
|
|
209
|
+
# Serverless directories
|
|
210
|
+
.serverless/
|
|
211
|
+
|
|
212
|
+
# FuseBox cache
|
|
213
|
+
.fusebox/
|
|
214
|
+
|
|
215
|
+
# DynamoDB Local files
|
|
216
|
+
.dynamodb/
|
|
217
|
+
|
|
218
|
+
# TernJS port file
|
|
219
|
+
.tern-port
|
|
220
|
+
|
|
221
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
222
|
+
.vscode-test
|
|
223
|
+
|
|
224
|
+
# yarn v2
|
|
225
|
+
.yarn/cache
|
|
226
|
+
.yarn/unplugged
|
|
227
|
+
.yarn/build-state.yml
|
|
228
|
+
.yarn/install-state.gz
|
|
229
|
+
.pnp.*
|
|
230
|
+
|
|
231
|
+
### Node Patch ###
|
|
232
|
+
# Serverless Webpack directories
|
|
233
|
+
.webpack/
|
|
234
|
+
|
|
235
|
+
# Optional stylelint cache
|
|
236
|
+
|
|
237
|
+
# SvelteKit build / generate output
|
|
238
|
+
.svelte-kit
|
|
239
|
+
|
|
240
|
+
### Python ###
|
|
241
|
+
# Byte-compiled / optimized / DLL files
|
|
242
|
+
__pycache__/
|
|
243
|
+
*.py[cod]
|
|
244
|
+
*$py.class
|
|
245
|
+
|
|
246
|
+
# C extensions
|
|
247
|
+
|
|
248
|
+
# Distribution / packaging
|
|
249
|
+
.Python
|
|
250
|
+
build/
|
|
251
|
+
develop-eggs/
|
|
252
|
+
dist/
|
|
253
|
+
downloads/
|
|
254
|
+
eggs/
|
|
255
|
+
.eggs/
|
|
256
|
+
lib/
|
|
257
|
+
lib64/
|
|
258
|
+
parts/
|
|
259
|
+
sdist/
|
|
260
|
+
var/
|
|
261
|
+
wheels/
|
|
262
|
+
share/python-wheels/
|
|
263
|
+
*.egg-info/
|
|
264
|
+
.installed.cfg
|
|
265
|
+
*.egg
|
|
266
|
+
MANIFEST
|
|
267
|
+
|
|
268
|
+
# PyInstaller
|
|
269
|
+
# Usually these files are written by a python script from a template
|
|
270
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
271
|
+
*.manifest
|
|
272
|
+
*.spec
|
|
273
|
+
|
|
274
|
+
# Installer logs
|
|
275
|
+
pip-log.txt
|
|
276
|
+
pip-delete-this-directory.txt
|
|
277
|
+
|
|
278
|
+
# Unit test / coverage reports
|
|
279
|
+
htmlcov/
|
|
280
|
+
.tox/
|
|
281
|
+
.nox/
|
|
282
|
+
.coverage
|
|
283
|
+
.coverage.*
|
|
284
|
+
nosetests.xml
|
|
285
|
+
coverage.xml
|
|
286
|
+
*.cover
|
|
287
|
+
*.py,cover
|
|
288
|
+
.hypothesis/
|
|
289
|
+
.pytest_cache/
|
|
290
|
+
cover/
|
|
291
|
+
|
|
292
|
+
# Translations
|
|
293
|
+
*.mo
|
|
294
|
+
*.pot
|
|
295
|
+
|
|
296
|
+
# Django stuff:
|
|
297
|
+
local_settings.py
|
|
298
|
+
db.sqlite3
|
|
299
|
+
db.sqlite3-journal
|
|
300
|
+
|
|
301
|
+
# Flask stuff:
|
|
302
|
+
instance/
|
|
303
|
+
.webassets-cache
|
|
304
|
+
|
|
305
|
+
# Scrapy stuff:
|
|
306
|
+
.scrapy
|
|
307
|
+
|
|
308
|
+
# Sphinx documentation
|
|
309
|
+
docs/_build/
|
|
310
|
+
|
|
311
|
+
# PyBuilder
|
|
312
|
+
.pybuilder/
|
|
313
|
+
target/
|
|
314
|
+
|
|
315
|
+
# Jupyter Notebook
|
|
316
|
+
.ipynb_checkpoints
|
|
317
|
+
|
|
318
|
+
# IPython
|
|
319
|
+
profile_default/
|
|
320
|
+
ipython_config.py
|
|
321
|
+
|
|
322
|
+
# pyenv
|
|
323
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
324
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
325
|
+
# .python-version
|
|
326
|
+
|
|
327
|
+
# pipenv
|
|
328
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
329
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
330
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
331
|
+
# install all needed dependencies.
|
|
332
|
+
#Pipfile.lock
|
|
333
|
+
|
|
334
|
+
# poetry
|
|
335
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
336
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
337
|
+
# commonly ignored for libraries.
|
|
338
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
339
|
+
#poetry.lock
|
|
340
|
+
|
|
341
|
+
# pdm
|
|
342
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
343
|
+
#pdm.lock
|
|
344
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
345
|
+
# in version control.
|
|
346
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
347
|
+
.pdm.toml
|
|
348
|
+
|
|
349
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
350
|
+
__pypackages__/
|
|
351
|
+
|
|
352
|
+
# Celery stuff
|
|
353
|
+
celerybeat-schedule
|
|
354
|
+
celerybeat.pid
|
|
355
|
+
|
|
356
|
+
# SageMath parsed files
|
|
357
|
+
*.sage.py
|
|
358
|
+
|
|
359
|
+
# Environments
|
|
360
|
+
.venv
|
|
361
|
+
env/
|
|
362
|
+
venv/
|
|
363
|
+
ENV/
|
|
364
|
+
env.bak/
|
|
365
|
+
venv.bak/
|
|
366
|
+
|
|
367
|
+
# Spyder project settings
|
|
368
|
+
.spyderproject
|
|
369
|
+
.spyproject
|
|
370
|
+
|
|
371
|
+
# Rope project settings
|
|
372
|
+
.ropeproject
|
|
373
|
+
|
|
374
|
+
# mkdocs documentation (build output, any package)
|
|
375
|
+
site/
|
|
376
|
+
|
|
377
|
+
# mypy
|
|
378
|
+
.mypy_cache/
|
|
379
|
+
.dmypy.json
|
|
380
|
+
dmypy.json
|
|
381
|
+
|
|
382
|
+
# Pyre type checker
|
|
383
|
+
.pyre/
|
|
384
|
+
|
|
385
|
+
# pytype static type analyzer
|
|
386
|
+
.pytype/
|
|
387
|
+
|
|
388
|
+
# Cython debug symbols
|
|
389
|
+
cython_debug/
|
|
390
|
+
|
|
391
|
+
# PyCharm
|
|
392
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
393
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
394
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
395
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
396
|
+
#.idea/
|
|
397
|
+
|
|
398
|
+
### Python Patch ###
|
|
399
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
400
|
+
poetry.toml
|
|
401
|
+
|
|
402
|
+
# ruff
|
|
403
|
+
.ruff_cache/
|
|
404
|
+
|
|
405
|
+
# LSP config files
|
|
406
|
+
pyrightconfig.json
|
|
407
|
+
|
|
408
|
+
### Rust ###
|
|
409
|
+
# Generated by Cargo
|
|
410
|
+
# will have compiled files and executables
|
|
411
|
+
debug/
|
|
412
|
+
|
|
413
|
+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
|
414
|
+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
|
415
|
+
Cargo.lock
|
|
416
|
+
|
|
417
|
+
# These are backup files generated by rustfmt
|
|
418
|
+
**/*.rs.bk
|
|
419
|
+
|
|
420
|
+
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
421
|
+
|
|
422
|
+
### VisualStudioCode ###
|
|
423
|
+
.vscode/*
|
|
424
|
+
!.vscode/settings.json
|
|
425
|
+
!.vscode/tasks.json
|
|
426
|
+
!.vscode/launch.json
|
|
427
|
+
!.vscode/extensions.json
|
|
428
|
+
!.vscode/*.code-snippets
|
|
429
|
+
|
|
430
|
+
# Local History for Visual Studio Code
|
|
431
|
+
.history/
|
|
432
|
+
|
|
433
|
+
# Built Visual Studio Code Extensions
|
|
434
|
+
*.vsix
|
|
435
|
+
|
|
436
|
+
### VisualStudioCode Patch ###
|
|
437
|
+
# Ignore all local history of files
|
|
438
|
+
.history
|
|
439
|
+
.ionide
|
|
440
|
+
|
|
441
|
+
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
|
|
442
|
+
|
|
443
|
+
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
|
444
|
+
#
|
|
445
|
+
# Commit sources and generators, not build, documentation, license, or benchmark outputs.
|
|
446
|
+
|
|
447
|
+
!.envrc
|
|
448
|
+
!/Cargo.lock
|
|
449
|
+
|
|
450
|
+
.codex
|
|
451
|
+
.claude/
|
|
452
|
+
.agents/
|
|
453
|
+
.codex/
|
|
454
|
+
**/AGENTS.md
|
|
455
|
+
**/CLAUDE.md
|
|
456
|
+
.uv-cache/
|
|
457
|
+
repomix-output.xml
|
|
458
|
+
uv.lock
|
|
459
|
+
# Free-threaded / variant venvs (uv creates .venv-t etc.; plain .venv is above)
|
|
460
|
+
.venv*/
|
|
461
|
+
**/.venv*/
|
|
462
|
+
|
|
463
|
+
# LLVM/coverage profiles (also under target/, but may land elsewhere)
|
|
464
|
+
.pgo/
|
|
465
|
+
*.profraw
|
|
466
|
+
*.profdata
|
|
467
|
+
|
|
468
|
+
# Per-package cargo targets (h2corn target-py314t, gometry target-local, …)
|
|
469
|
+
**/target-*/
|
|
470
|
+
|
|
471
|
+
githead/tests/git/HEAD
|
|
472
|
+
jinja2-htmlmin/tests/templates/.*
|
|
473
|
+
|
|
474
|
+
# Benchmark measurements, provenance, tables, and plots are external artifacts.
|
|
475
|
+
**/bench/results/
|
|
476
|
+
**/benches/results/
|
|
477
|
+
**/benchmarks/results/
|
|
478
|
+
**/docs/assets/benchmark-runs/
|
|
479
|
+
**/docs/assets/benchmark-*.svg
|
|
480
|
+
h2corn/bench/*.bin
|
|
481
|
+
h2corn/examples/grpc/gen/
|
|
482
|
+
|
|
483
|
+
# gometry: the only genuinely package-specific rules (build artifacts and
|
|
484
|
+
# LICENSE-*.md are already covered by the general `target/` and `**/LICENSE*.md`
|
|
485
|
+
# rules above). This coverage output is gometry-tool-specific:
|
|
486
|
+
gometry/coverage-python/
|
|
487
|
+
# The root Node-template `coverage` rule would otherwise hide this Rust source
|
|
488
|
+
# module; generated Python coverage reports remain ignored above.
|
|
489
|
+
!gometry/src/geometry/coverage/
|
|
490
|
+
!gometry/src/geometry/coverage/**
|
|
491
|
+
|
|
492
|
+
# mkdocs / properdocs build output (any package)
|
|
493
|
+
**/site/
|
|
494
|
+
test-results/
|
|
495
|
+
|
|
496
|
+
# Generated license files (any released package). Rendered at build time by
|
|
497
|
+
# .github/scripts/gen_licenses.py from each pyproject's SPDX expression (own
|
|
498
|
+
# license, one file per OR choice) and the Cargo dependency graph (rusty
|
|
499
|
+
# third-party bundle), then bundled into the wheel/sdist via the PEP 639
|
|
500
|
+
# default license-files glob. Every generated license file is LICENSE*.md;
|
|
501
|
+
# no license text is ever committed.
|
|
502
|
+
**/LICENSE*.md
|
githead-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: githead
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Simple utility for getting the current git commit hash (HEAD)
|
|
5
|
+
Project-URL: Issues, https://github.com/Zaczero/pkgs/issues
|
|
6
|
+
Project-URL: Repository, https://github.com/Zaczero/pkgs/tree/main/githead
|
|
7
|
+
Author-email: Kamil Monicz <kamil@monicz.dev>
|
|
8
|
+
License-Expression: 0BSD
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Keywords: commit,git,git-commit,hash,head,vcs,version-control
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Zero-Clause BSD (0BSD)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# githead
|
|
26
|
+
|
|
27
|
+
[](https://pypi.org/p/githead)
|
|
28
|
+
|
|
29
|
+
Read a checkout's Git HEAD from Python without launching Git. Python 3.11+.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pip install githead
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<a id="first-result"></a>
|
|
38
|
+
|
|
39
|
+
## Read a checkout's HEAD
|
|
40
|
+
|
|
41
|
+
Run from a checkout with a `.git` directory and a loose HEAD reference:
|
|
42
|
+
|
|
43
|
+
```py
|
|
44
|
+
from githead import githead
|
|
45
|
+
|
|
46
|
+
print(githead())
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## githead reference
|
|
50
|
+
|
|
51
|
+
`githead(git_dir=".git")` accepts the metadata directory, not the working-tree
|
|
52
|
+
root. It returns the stripped contents of a detached `HEAD` or its loose
|
|
53
|
+
reference file.
|
|
54
|
+
|
|
55
|
+
This is a small file reader, not a general Git interface: packed refs, reftable,
|
|
56
|
+
unborn branches, and `.git` files used by worktrees or submodules are unsupported.
|
|
57
|
+
Missing files raise `FileNotFoundError`; references outside `git_dir` raise
|
|
58
|
+
`ValueError`. Other file-reading errors propagate.
|
|
59
|
+
|
|
60
|
+
[Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.0/githead/githead/__init__.py) ·
|
|
61
|
+
[Issues and questions](https://github.com/Zaczero/pkgs/issues) ·
|
|
62
|
+
[Private security reports](https://github.com/Zaczero/pkgs/security/advisories/new) ·
|
|
63
|
+
[Premium support](https://monicz.dev/#get-in-touch)
|
githead-2.0.0/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# githead
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/p/githead)
|
|
4
|
+
|
|
5
|
+
Read a checkout's Git HEAD from Python without launching Git. Python 3.11+.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install githead
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
<a id="first-result"></a>
|
|
14
|
+
|
|
15
|
+
## Read a checkout's HEAD
|
|
16
|
+
|
|
17
|
+
Run from a checkout with a `.git` directory and a loose HEAD reference:
|
|
18
|
+
|
|
19
|
+
```py
|
|
20
|
+
from githead import githead
|
|
21
|
+
|
|
22
|
+
print(githead())
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## githead reference
|
|
26
|
+
|
|
27
|
+
`githead(git_dir=".git")` accepts the metadata directory, not the working-tree
|
|
28
|
+
root. It returns the stripped contents of a detached `HEAD` or its loose
|
|
29
|
+
reference file.
|
|
30
|
+
|
|
31
|
+
This is a small file reader, not a general Git interface: packed refs, reftable,
|
|
32
|
+
unborn branches, and `.git` files used by worktrees or submodules are unsupported.
|
|
33
|
+
Missing files raise `FileNotFoundError`; references outside `git_dir` raise
|
|
34
|
+
`ValueError`. Other file-reading errors propagate.
|
|
35
|
+
|
|
36
|
+
[Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.0/githead/githead/__init__.py) ·
|
|
37
|
+
[Issues and questions](https://github.com/Zaczero/pkgs/issues) ·
|
|
38
|
+
[Private security reports](https://github.com/Zaczero/pkgs/security/advisories/new) ·
|
|
39
|
+
[Premium support](https://monicz.dev/#get-in-touch)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
__version__ = '2.0.0'
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from os import PathLike
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def githead(git_dir: PathLike[str] | str = '.git') -> str:
|
|
13
|
+
"""Read detached HEAD text or a loose symbolic reference.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
git_dir
|
|
18
|
+
Path to the Git metadata directory itself.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
str
|
|
23
|
+
The stripped contents of ``HEAD`` or of its referenced loose file.
|
|
24
|
+
Detached contents are not validated as an object ID.
|
|
25
|
+
|
|
26
|
+
Raises
|
|
27
|
+
------
|
|
28
|
+
FileNotFoundError
|
|
29
|
+
If ``HEAD`` or its loose reference file is missing.
|
|
30
|
+
ValueError
|
|
31
|
+
If a symbolic reference resolves outside ``git_dir``.
|
|
32
|
+
OSError
|
|
33
|
+
For other filesystem read errors.
|
|
34
|
+
UnicodeError
|
|
35
|
+
If the file contents cannot be decoded as text.
|
|
36
|
+
|
|
37
|
+
Notes
|
|
38
|
+
-----
|
|
39
|
+
This function does not discover repository metadata, invoke Git, read
|
|
40
|
+
packed refs or reftable, or follow a worktree's common-directory file.
|
|
41
|
+
"""
|
|
42
|
+
dir_path = Path(git_dir)
|
|
43
|
+
head_path = dir_path.joinpath('HEAD')
|
|
44
|
+
head = head_path.read_text().strip()
|
|
45
|
+
|
|
46
|
+
is_symbolic = head[:5] == 'ref: '
|
|
47
|
+
if not is_symbolic:
|
|
48
|
+
return head
|
|
49
|
+
|
|
50
|
+
dir_abs = dir_path.resolve()
|
|
51
|
+
ref_abs = dir_abs.joinpath(head[5:]).resolve()
|
|
52
|
+
if not ref_abs.is_relative_to(dir_abs):
|
|
53
|
+
raise ValueError(f'HEAD references outside of {git_dir} directory')
|
|
54
|
+
|
|
55
|
+
ref = ref_abs.read_text().strip()
|
|
56
|
+
return ref
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
__all__ = ('githead',)
|