Skip to content

Commit 698f624

Browse files
committed
bin/check-warn.sh: add a merge argument
Add a merge argument to automatically find the merge-base for the given commits. This prevents things like master moving forward and removing warnings that a PR branch may still have from appearing as a regression. Signed-off-by: Randolph Sapp <[email protected]>
1 parent 518edb3 commit 698f624

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bin/check-warn.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ DIFF OPTIONS:
1616
acceptable
1717
-b NEW git branch or commit ID NEW for checking WARNING(s), 'HEAD'
1818
is acceptable
19+
-m, --merge automatically pick the merge-base for the given commits
1920
2021
OTHER OPTIONS:
2122
-h, --help this message
@@ -112,6 +113,12 @@ main()
112113
_old=$(rev-parse "${_old}")
113114
_new=$(rev-parse "${_new}")
114115

116+
if [ -n "${_merge}" ] && ! _old=$(git merge-base "${_old}" "${_new}")
117+
then
118+
echo "Error: Unable to find merge-base for the given commits"
119+
exit 5
120+
fi
121+
115122
generate_log "${_old}" "_a"
116123
generate_log "${_new}" "_b"
117124

@@ -126,6 +133,7 @@ while [ "$#" -gt 0 ]; do
126133
-o | --os) shift; _os=$1; shift;;
127134
-a) shift; _old=$1; shift;;
128135
-b) shift; _new=$1; shift;;
136+
-m | --merge) shift; _merge=1;;
129137
*) shift;;
130138
esac
131139
done

0 commit comments

Comments
 (0)