diff options
-rwxr-xr-x | hooks/commit-msg | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/hooks/commit-msg b/hooks/commit-msg index ecd6a20b..5b1fe3ae 100755 --- a/hooks/commit-msg +++ b/hooks/commit-msg | |||
@@ -1,4 +1,22 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # From Gerrit Code Review v2.0.18-100-g98fc90a | ||
3 | # | ||
4 | # Part of Gerrit Code Review (http://code.google.com/p/gerrit/) | ||
5 | # | ||
6 | # Copyright (C) 2009 The Android Open Source Project | ||
7 | # | ||
8 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
9 | # you may not use this file except in compliance with the License. | ||
10 | # You may obtain a copy of the License at | ||
11 | # | ||
12 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
13 | # | ||
14 | # Unless required by applicable law or agreed to in writing, software | ||
15 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
17 | # See the License for the specific language governing permissions and | ||
18 | # limitations under the License. | ||
19 | # | ||
2 | 20 | ||
3 | MSG="$1" | 21 | MSG="$1" |
4 | 22 | ||
@@ -13,8 +31,12 @@ add_ChangeId() { | |||
13 | id=$(_gen_ChangeId) | 31 | id=$(_gen_ChangeId) |
14 | out="$MSG.new" | 32 | out="$MSG.new" |
15 | ftt="$MSG.footers" | 33 | ftt="$MSG.footers" |
16 | sed -e '/^[A-Za-z][A-Za-z0-9-]*: /,$d' <"$MSG" >"$out" | 34 | sed -e '2,${ |
17 | sed -ne '/^[A-Za-z][A-Za-z0-9-]*: /,$p' <"$MSG" >"$ftt" | 35 | /^[A-Za-z][A-Za-z0-9-]*: /,$d |
36 | }' <"$MSG" >"$out" | ||
37 | sed -ne '2,${ | ||
38 | /^[A-Za-z][A-Za-z0-9-]*: /,$p | ||
39 | }' <"$MSG" >"$ftt" | ||
18 | if ! [ -s "$ftt" ] | 40 | if ! [ -s "$ftt" ] |
19 | then | 41 | then |
20 | echo >>"$out" | 42 | echo >>"$out" |