diff options
Diffstat (limited to 'util/git-hooks')
-rwxr-xr-x | util/git-hooks/commit-msg | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/util/git-hooks/commit-msg b/util/git-hooks/commit-msg index 3b3d5415..b9217e08 100755 --- a/util/git-hooks/commit-msg +++ b/util/git-hooks/commit-msg @@ -6,6 +6,10 @@ # # Copyright (C) 2009 The Android Open Source Project # +# Any other changes including test_duplicate_signoffs_acks +# +# Copyright (C) 2017 Stefan Tauner +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -188,5 +192,18 @@ _gen_ChangeId() { git hash-object -t commit --stdin } +# Test for duplicate signoffs/acks +test_duplicate_signoffs_acks() { + test "" = "$(grep -i '^(Signed-off-by|Acked-by): ' "$MSG" | + sort | uniq -c | sed -e '/^[[:space:]]*1[[:space:]]/d')" || { + echo "Duplicate Signed-off-by or Acked-by lines." >&2 + exit 1 + } +} + +main() { + test_duplicate_signoffs_acks + add_ChangeId +} -add_ChangeId +main |