githead 2.0.0__tar.gz → 2.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: githead
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Simple utility for getting the current git commit hash (HEAD)
5
5
  Project-URL: Issues, https://github.com/Zaczero/pkgs/issues
6
6
  Project-URL: Repository, https://github.com/Zaczero/pkgs/tree/main/githead
@@ -57,7 +57,7 @@ unborn branches, and `.git` files used by worktrees or submodules are unsupporte
57
57
  Missing files raise `FileNotFoundError`; references outside `git_dir` raise
58
58
  `ValueError`. Other file-reading errors propagate.
59
59
 
60
- [Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.0/githead/githead/__init__.py) ·
60
+ [Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.1/githead/githead/__init__.py) ·
61
61
  [Issues and questions](https://github.com/Zaczero/pkgs/issues) ·
62
62
  [Private security reports](https://github.com/Zaczero/pkgs/security/advisories/new) ·
63
63
  [Premium support](https://monicz.dev/#get-in-touch)
@@ -33,7 +33,7 @@ unborn branches, and `.git` files used by worktrees or submodules are unsupporte
33
33
  Missing files raise `FileNotFoundError`; references outside `git_dir` raise
34
34
  `ValueError`. Other file-reading errors propagate.
35
35
 
36
- [Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.0/githead/githead/__init__.py) ·
36
+ [Full reference](https://raw.githubusercontent.com/Zaczero/pkgs/githead/2.0.1/githead/githead/__init__.py) ·
37
37
  [Issues and questions](https://github.com/Zaczero/pkgs/issues) ·
38
38
  [Private security reports](https://github.com/Zaczero/pkgs/security/advisories/new) ·
39
39
  [Premium support](https://monicz.dev/#get-in-touch)
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = '2.0.0'
3
+ __version__ = '2.0.1'
4
4
 
5
5
  from pathlib import Path
6
6
  from typing import TYPE_CHECKING
@@ -43,12 +43,12 @@ def githead(git_dir: PathLike[str] | str = '.git') -> str:
43
43
  head_path = dir_path.joinpath('HEAD')
44
44
  head = head_path.read_text().strip()
45
45
 
46
- is_symbolic = head[:5] == 'ref: '
47
- if not is_symbolic:
46
+ ref_target = head.removeprefix('ref: ')
47
+ if ref_target == head:
48
48
  return head
49
49
 
50
50
  dir_abs = dir_path.resolve()
51
- ref_abs = dir_abs.joinpath(head[5:]).resolve()
51
+ ref_abs = dir_abs.joinpath(ref_target).resolve()
52
52
  if not ref_abs.is_relative_to(dir_abs):
53
53
  raise ValueError(f'HEAD references outside of {git_dir} directory')
54
54
 
@@ -27,7 +27,6 @@ classifiers = [
27
27
  "Topic :: Software Development :: Libraries :: Python Modules",
28
28
  "Typing :: Typed",
29
29
  ]
30
- dependencies = []
31
30
  dynamic = ["version"]
32
31
 
33
32
  [project.urls]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes