Skip to content

Commit 435ad57

Browse files
committed
Merge bitcoin/bitcoin#31479: lint: Disable signature output in git log
e2d3372 lint: Disable signature output in git log (Hodlinator) Pull request description: Necessary for users that have signature output enabled by default, since the script would stumble on them and error out. --- ### Testing setup Set local repo config to show signatures in log by default, simulating a user having that setting turned on globally. ``` ₿ git config set log.showSignature true ``` ### Command under test ``` ₿ ( cd ./test/lint/test_runner/ && COMMIT_RANGE='HEAD^..HEAD' cargo run ) ``` #### Before ``` ... fatal: invalid object name 'gpg'. Traceback (most recent call last): File "/home/hodlinator/bitcoin/test/lint/lint-git-commit-check.py", line 52, in <module> main() File "/home/hodlinator/bitcoin/test/lint/lint-git-commit-check.py", line 42, in main commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], text=True, encoding="utf8").splitlines() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/wfbjq35kxs6x83c3ncpfxdyl5gbhdx4h-python3-3.12.6/lib/python3.12/subprocess.py", line 466, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/wfbjq35kxs6x83c3ncpfxdyl5gbhdx4h-python3-3.12.6/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['git', 'log', '--format=%B', '-n', '1', 'gpg: Signature made ons 11 dec 2024 10:46:34 CET']' returned non-zero exit status 128. ^---- ⚠️ Failure generated from lint-git-commit-check.py ... ``` #### After (No failure generated by *lint-git-commit-check.py*). ACKs for top commit: maflcko: lgtm ACK e2d3372 willcl-ark: ACK e2d3372 Tree-SHA512: 584ccece1e6e0f4691683a2b1816eff33b88f48e9ead9272e2dc73ea9c637b182632108fbeddea1ffc8ed6ba5a5838d7eac7a9f33dfda5bdf325dd7a41e43365
2 parents ea9e64f + e2d3372 commit 435ad57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/lint/lint-git-commit-check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def main():
3636
assert os.getenv("COMMIT_RANGE") # E.g. COMMIT_RANGE='HEAD~n..HEAD'
3737
commit_range = os.getenv("COMMIT_RANGE")
3838

39-
commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], text=True, encoding="utf8").splitlines()
39+
commit_hashes = check_output(["git", "-c", "log.showSignature=false", "log", commit_range, "--format=%H"], text=True, encoding="utf8").splitlines()
4040

4141
for hash in commit_hashes:
42-
commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], text=True, encoding="utf8").splitlines()
42+
commit_info = check_output(["git", "-c", "log.showSignature=false", "log", "--format=%B", "-n", "1", hash], text=True, encoding="utf8").splitlines()
4343
if len(commit_info) >= 2:
4444
if commit_info[1]:
4545
print(f"The subject line of commit hash {hash} is followed by a non-empty line. Subject lines should always be followed by a blank line.")

0 commit comments

Comments
 (0)