projects
/
git-mirror.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some more README work
[git-mirror.git]
/
githook.py
diff --git
a/githook.py
b/githook.py
index b5286442edda8b93ac9d3c90240df073268fcd07..a503a470eee76de88b31c2c5442d139b47f1c441 100755
(executable)
--- a/
githook.py
+++ b/
githook.py
@@
-1,5
+1,5
@@
-#!/usr/bin/python3
-# Copyright (c) 201
4
, Ralf Jung <post@ralfj.de>
+#!/usr/bin/
env
python3
+# Copyright (c) 201
5
, Ralf Jung <post@ralfj.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@
-41,11
+41,14
@@
if __name__ == "__main__":
repo = repos[reponame]
# parse the information we get from stdin. we trust this information.
for line in sys.stdin:
repo = repos[reponame]
# parse the information we get from stdin. we trust this information.
for line in sys.stdin:
- (oldsha, newsha, ref) = line.split()
+ line = line.split()
+ if len(line) == 0: continue
+ assert len(line) == 3
+ (oldsha, newsha, ref) = line
repo.update_mirrors(ref, oldsha, newsha)
except Exception as e:
if repo is not None:
repo.update_mirrors(ref, oldsha, newsha)
except Exception as e:
if repo is not None:
- repo.mail_owner("There was a problem running the git-mirror git hook:\n\n{
0
}".format(traceback.format_exc()))
+ repo.mail_owner("There was a problem running the git-mirror git hook:\n\n{}".format(traceback.format_exc()))
# do not print all the details
# do not print all the details
- sys.stderr.write("We have a problem:\n{
0
}".format('\n'.join(traceback.format_exception_only(type(e), e))))
+ sys.stderr.write("We have a problem:\n{}".format('\n'.join(traceback.format_exception_only(type(e), e))))