Skip to content

Commit

Permalink
fix: add -c log.showsignature=false to all git log commands if gi…
Browse files Browse the repository at this point in the history
…t version is >= 2.10.0

Signed-off-by: Patrick Decat <[email protected]>
  • Loading branch information
pdecat committed Feb 3, 2024
1 parent 8a16c30 commit 9c49a84
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions dunamai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,16 @@ def normalize_tag_ref(ref: str) -> str:
def from_git_tag_topo_order(
tag_branch: str, git_version: List[int], path: Optional[Path]
) -> Mapping[str, int]:
cmd = (
"git log --simplify-by-decoration --topo-order --decorate=full"
' {} "--format=%H%d"'.format(tag_branch)
)
if git_version < [2, 10]:
cmd = (
"git log --simplify-by-decoration --topo-order"
' --decorate=full {} "--format=%H%d"'.format(tag_branch)
)
else:
cmd = (
"git -c log.showsignature=false log --simplify-by-decoration --topo-order"
' --decorate=full {} "--format=%H%d"'.format(tag_branch)
)
if git_version >= [2, 16]:
cmd += " --decorate-refs=refs/tags/"
code, logmsg = _run_cmd(cmd, path)
Expand Down Expand Up @@ -1088,11 +1094,20 @@ def from_git(
else:
branch = msg

code, msg = _run_cmd(
'git log -n 1 --format="format:{}"'.format("%H" if full_commit else "%h"),
path,
codes=[0, 128],
)
if git_version < [2, 10]:
code, msg = _run_cmd(
'git log -n 1 --format="format:{}"'.format("%H" if full_commit else "%h"),
path,
codes=[0, 128],
)
else:
code, msg = _run_cmd(
'git -c log.showsignature=false log -n 1 --format="format:{}"'.format(
"%H" if full_commit else "%h"
),
path,
codes=[0, 128],
)
if code == 128:
return cls._fallback(
strict, distance=0, dirty=True, branch=branch, concerns=concerns, vcs=vcs
Expand All @@ -1104,9 +1119,12 @@ def from_git(
code, msg = _run_cmd('git log -n 1 --pretty=format:"%ci"', path)
timestamp = _parse_git_timestamp_iso(msg)
else:
code, msg = _run_cmd(
'git -c log.showsignature=false log -n 1 --pretty=format:"%cI"', path
)
if git_version < [2, 10]:
code, msg = _run_cmd('git log -n 1 --pretty=format:"%cI"', path)
else:
code, msg = _run_cmd(
'git -c log.showsignature=false log -n 1 --pretty=format:"%cI"', path
)
timestamp = _parse_git_timestamp_iso_strict(msg)

code, msg = _run_cmd("git describe --always --dirty", path)
Expand Down

0 comments on commit 9c49a84

Please sign in to comment.