Skip to content

Commit fa96819

Browse files
authored
Add debug to Commit checker script (#738)
It would help to resolve failures on CI easier. Add condition for master git log. Relates-To: OLPEDGE-1753 Signed-off-by: Yaroslav Stefinko <[email protected]>
1 parent b6605ff commit fa96819

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/misc/commit_checker.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@
2323
# Requirements can be find in scripts/misc/commit_message_recom.txt
2424

2525
# Saving whole commit message into file for reading below
26-
echo "`git log --pretty=format:'%B' -2 | sed '1d' | sed '1d' `" >> commit.log
26+
set -x
27+
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || branch_name="branch" # detached HEAD
28+
branch_name=${branch_name##refs/heads/}
29+
if [ "$branch_name" = "master" ]; then
30+
echo "`git log --pretty=format:'%B' -1`" >> commit.log
31+
else
32+
echo "`git log --pretty=format:'%B' -2 | sed '1d' | sed '1d' `" >> commit.log
33+
fi
34+
set +x
2735

2836
# Counting number of lines in file
2937
num_lines=`wc -l commit.log| cut -d'c' -f1`
@@ -45,7 +53,7 @@ do
4553
exit 1
4654
fi
4755
if [ ${current_line_len} -gt 72 ] ; then
48-
echo "ERROR: ${current_line_len} chars in ${line}-th line is too long. This line must be less than 80 chars"
56+
echo "ERROR: ${current_line_len} chars in ${line}-th line is too long. This line must be less than 72 chars"
4957
exit 1
5058
fi
5159
echo " ${line}-th line is ${current_line_len} chars length"

0 commit comments

Comments
 (0)