Add merge commit support to tools/check-signed-off.sh and re-introduce signed-off check to Travis CI

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss 2016-02-17 23:41:44 +01:00
parent 6107f3599e
commit 5afc0600b4
2 changed files with 23 additions and 5 deletions

View File

@ -13,7 +13,7 @@ install: make prerequisites
script: "make -j VERBOSE=1 NINJA=1 $TARGET"
env:
- TARGET="check-vera check-cpp"
- TARGET="check-signed-off check-vera check-cpp"
- TARGET="build.linux test-js-precommit"
- TARGET=build.mcu_stm32f3
- TARGET=build.mcu_stm32f4

View File

@ -15,11 +15,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
commit_hash=`git show -s --format=%H HEAD`
author_name=`git show -s --format=%an HEAD`
author_email=`git show -s --format=%ae HEAD`
parent_hashes=(`git show -s --format=%p HEAD | head -1`)
if [ "${#parent_hashes[@]}" -eq 1 ]
then
commit_hash=`git show -s --format=%h HEAD | head -1`
elif [ "${#parent_hashes[@]}" -eq 2 ]
then
if git merge-base --is-ancestor "${parent_hashes[@]}"
then
commit_hash=${parent_hashes[1]}
else
echo "$0: cannot handle merge commit where first parent ${parent_hashes[0]} is not ancestor of second parent ${parent_hashes[1]}"
exit 1
fi
else
echo "$0: cannot handle commit with ${#parent_hashes[@]} parents ${parent_hashes[@]}"
exit 1
fi
author_name=`git show -s --format=%an $commit_hash`
author_email=`git show -s --format=%ae $commit_hash`
required_signed_off_by_line="JerryScript-DCO-1.0-Signed-off-by: $author_name $author_email"
actual_signed_off_by_line=`git show -s --format=%B HEAD | sed '/^$/d' | tail -n 1`
actual_signed_off_by_line=`git show -s --format=%B $commit_hash | sed '/^$/d' | tail -n 1`
if [ "$actual_signed_off_by_line" != "$required_signed_off_by_line" ]
then