Commit 3eb06812 authored by Almir Okato's avatar Almir Okato Committed by Fabio Utzig
Browse files

ci: add single parent commit case on check-signed-off-by script

parent 5047f032
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -12,17 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# this retrieves the merge commit created by GH
parents=(`git log -n 1 --format=%p HEAD`)

if [[ "${#parents[@]}" -ne 2 ]]; then
  echo "This PR's merge commit is missing a parent!"
  exit 1
fi

if [[ "${#parents[@]}" -eq 1 ]]; then
  # CI doesn't use a merge commit
  commits=$(git show -s --format=%h ${parents})
elif [[ "${#parents[@]}" -eq 2 ]]; then
  # CI uses a merge commit, eg GH / Travis
  from="${parents[0]}"
  into="${parents[1]}"
  commits=$(git show -s --format=%h ${from}..${into})
else
  echo "Unexpected behavior, cannot verify more than 2 parent commits!"
  exit 1
fi

has_commits=false
for sha in $commits; do