Skip to content

Commit cd69e80

Browse files
committed
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 [email protected]
1 parent b2426a7 commit cd69e80

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ install: make prerequisites
1313
script: "make -j VERBOSE=1 NINJA=1 $TARGET"
1414

1515
env:
16-
- TARGET="check-vera check-cpp"
16+
- TARGET="check-signed-off check-vera check-cpp"
1717
- TARGET="build.linux test-js-precommit"
1818
- TARGET=build.mcu_stm32f3
1919
- TARGET=build.mcu_stm32f4

tools/check-signed-off.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,29 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
commit_hash=`git show -s --format=%H HEAD`
19-
author_name=`git show -s --format=%an HEAD`
20-
author_email=`git show -s --format=%ae HEAD`
18+
parent_hashes=(`git show -s --format=%p HEAD | head -1`)
19+
20+
if [ "${#parent_hashes[@]}" -eq 1 ]
21+
then
22+
commit_hash=`git show -s --format=%h HEAD | head -1`
23+
elif [ "${#parent_hashes[@]}" -eq 2 ]
24+
then
25+
if git merge-base --is-ancestor "${parent_hashes[@]}"
26+
then
27+
commit_hash=${parent_hashes[1]}
28+
else
29+
echo "$0: cannot handle merge commit where first parent ${parent_hashes[0]} is not ancestor of second parent ${parent_hashes[1]}"
30+
exit 1
31+
fi
32+
else
33+
echo "$0: cannot handle commit with ${#parent_hashes[@]} parents ${parent_hashes[@]}"
34+
exit 1
35+
fi
36+
37+
author_name=`git show -s --format=%an $commit_hash`
38+
author_email=`git show -s --format=%ae $commit_hash`
2139
required_signed_off_by_line="JerryScript-DCO-1.0-Signed-off-by: $author_name $author_email"
22-
actual_signed_off_by_line=`git show -s --format=%B HEAD | sed '/^$/d' | tail -n 1`
40+
actual_signed_off_by_line=`git show -s --format=%B $commit_hash | sed '/^$/d' | tail -n 1`
2341

2442
if [ "$actual_signed_off_by_line" != "$required_signed_off_by_line" ]
2543
then

0 commit comments

Comments
 (0)