diff options
| -rwxr-xr-x | hooks/commit-msg | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hooks/commit-msg b/hooks/commit-msg index 5ca2b112..d8f009b6 100755 --- a/hooks/commit-msg +++ b/hooks/commit-msg | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # From Gerrit Code Review 2.6 | ||
| 3 | # | 2 | # |
| 4 | # Part of Gerrit Code Review (http://code.google.com/p/gerrit/) | 3 | # Part of Gerrit Code Review (http://code.google.com/p/gerrit/) |
| 5 | # | 4 | # |
| @@ -27,7 +26,7 @@ MSG="$1" | |||
| 27 | # | 26 | # |
| 28 | add_ChangeId() { | 27 | add_ChangeId() { |
| 29 | clean_message=`sed -e ' | 28 | clean_message=`sed -e ' |
| 30 | /^diff --git a\/.*/{ | 29 | /^diff --git .*/{ |
| 31 | s/// | 30 | s/// |
| 32 | q | 31 | q |
| 33 | } | 32 | } |
| @@ -39,6 +38,11 @@ add_ChangeId() { | |||
| 39 | return | 38 | return |
| 40 | fi | 39 | fi |
| 41 | 40 | ||
| 41 | if test "false" = "`git config --bool --get gerrit.createChangeId`" | ||
| 42 | then | ||
| 43 | return | ||
| 44 | fi | ||
| 45 | |||
| 42 | # Does Change-Id: already exist? if so, exit (no change). | 46 | # Does Change-Id: already exist? if so, exit (no change). |
| 43 | if grep -i '^Change-Id:' "$MSG" >/dev/null | 47 | if grep -i '^Change-Id:' "$MSG" >/dev/null |
| 44 | then | 48 | then |
| @@ -77,7 +81,7 @@ add_ChangeId() { | |||
| 77 | # Skip the line starting with the diff command and everything after it, | 81 | # Skip the line starting with the diff command and everything after it, |
| 78 | # up to the end of the file, assuming it is only patch data. | 82 | # up to the end of the file, assuming it is only patch data. |
| 79 | # If more than one line before the diff was empty, strip all but one. | 83 | # If more than one line before the diff was empty, strip all but one. |
| 80 | /^diff --git a/ { | 84 | /^diff --git / { |
| 81 | blankLines = 0 | 85 | blankLines = 0 |
| 82 | while (getline) { } | 86 | while (getline) { } |
| 83 | next | 87 | next |
