1
0
mirror of https://github.com/oskar456/dzonegit.git synced 2024-05-11 05:55:41 +00:00

Add smudge filter to replace $UNIXTIME directive on checkout

This commit is contained in:
Ondřej Caletka
2018-08-20 15:25:27 +02:00
parent 17f771bca6
commit 806976ca6e
4 changed files with 44 additions and 1 deletions

View File

@ -509,6 +509,15 @@ def post_receive(stdin=sys.stdin):
subprocess.run(cmd)
def smudge_serial(
bstdin=sys.stdin.buffer,
bstdout=sys.stdout.buffer,
unixtime=None,
):
"""Replace all $UNIXTIME directives with current unix time."""
bstdout.write(unixtime_directive(bstdin.read(), unixtime))
def get_action(argv=sys.argv):
name = Path(argv[0]).name
if "pre-commit" in name:
@ -519,6 +528,8 @@ def get_action(argv=sys.argv):
return pre_receive
if "post-receive" in name:
return post_receive
if "smudge" in name:
return smudge_serial
def main():