mirror of
https://github.com/AdaCore/git-hooks.git
synced 2026-02-12 12:43:11 -08:00
These testcases are testing the git-hooks behavior when using a commit-extra-checker hook. This hook works by receiving info about the commit to check via stdin, as a dictionary in JSON format. To help the testcase verify the data being passed via its stdin, the hook currently prints the contents of stdin verbatim. Unfortunately, this makes an unwarranted assumption about the order of the elements in that string representation, causing spurious differences when trying to run this testcase with Python 3.x. This commit enhances the scripts used by these testcases to output the contents of the data in a way which is always the same, regardless of the order it was passed in. TN: U530-006 Change-Id: Ia8b16611bb29b7601f14949ee5554c906b947853
18 lines
466 B
Python
Executable File
18 lines
466 B
Python
Executable File
#! /usr/bin/env python
|
|
import sys
|
|
import json
|
|
|
|
cli_args = sys.argv[1:]
|
|
stdin_data = sys.stdin.read()
|
|
|
|
print("DEBUG: commit-extra-checker.py {}".format(" ".join(cli_args)))
|
|
print("-----[ stdin ]-----")
|
|
checker_data = json.loads(stdin_data)
|
|
for k in sorted(checker_data.keys()):
|
|
print(" . {}: {}".format(k, checker_data[k]))
|
|
print("---[ end stdin ]---")
|
|
|
|
if "(bad-commit)" in stdin_data:
|
|
print("Error: Invalid bla bla bla. Rejecting Update.")
|
|
sys.exit(1)
|