Skip to content

Commit d0faf61

Browse files
authored
Fix git log parser on Azure (#740)
When it's PR build `git branch` shows like: `* (HEAD detached at pull/739/merge)` When it's master build: `* (HEAD detached at SOME_HASH)` Conditon will help to solve that. Relates-To: OLPEDGE-1753 Signed-off-by: Yaroslav Stefinko <[email protected]>
1 parent f1b3122 commit d0faf61

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/misc/commit_checker.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
# Saving whole commit message into file for reading below
2626
set -x
2727
git branch
28-
branch_name="$(git branch | grep \* | cut -d ' ' -f2)" || branch_name="master"
29-
if [ "$branch_name" = "master" ]; then
30-
echo "`git log --pretty=format:'%B' -1`" >> commit.log
31-
else
28+
branch_name="$(git branch | grep \* | cut -d ' ' -f5| cut -d ')' -f1)"
29+
if [[ "$branch_name" =~ "pull" ]] ; then
3230
echo "`git log --pretty=format:'%B' -2 | sed '1d' | sed '1d' `" >> commit.log
31+
else
32+
echo "`git log --pretty=format:'%B' -1`" >> commit.log
3333
fi
3434
set +x
3535

0 commit comments

Comments
 (0)