From nobody Mon May 6 05:43:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585320126; cv=none; d=zohomail.com; s=zohoarc; b=d54NzfqKKbIPqrQ5qJao3eonFYHiWuk+wV7Fw+Qujrla3nOzGeRFDVXZEX3Oru7Hjeb5dhigvPp6ZgFQdDfvjJOJCiPvZJGPGhAuZb8rKQnly1H5UM3sfRbtqUwDhXXjgLajFK8tH238t0ndxNroSzsUOOsT9g4pBkrJoC1u4UI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585320126; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IThe6WkOL4FZnrSBFYIo0Nl6Z4omFXaMQfGBd4SZV9U=; b=JRLUp9x8QlYjvLXCWbvNVxkuX4Zvv80vLjVYS7HQLBKwnpXVJf+s2kR/V/e5NYMCFLtZR9z9cmSlXjjbMBHTBs6rUEEl3ZObbNnPYk+l2WerESMF94GBvcpDymnj/CYgk9pvRp9XNXvrGHlqHiwxi6EUxyAt5WuFkwJiosYkKvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585320126851265.86800784872935; Fri, 27 Mar 2020 07:42:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-391-Uro0HNl6NxeLhJxC19Rcnw-1; Fri, 27 Mar 2020 10:42:03 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE63E8010CA; Fri, 27 Mar 2020 14:41:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 804DF5C1C3; Fri, 27 Mar 2020 14:41:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B70E2182B010; Fri, 27 Mar 2020 14:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02REftlq008819 for ; Fri, 27 Mar 2020 10:41:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC7025DA7D; Fri, 27 Mar 2020 14:41:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B59B65DA75; Fri, 27 Mar 2020 14:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585320125; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IThe6WkOL4FZnrSBFYIo0Nl6Z4omFXaMQfGBd4SZV9U=; b=gJvOI/c5/9tUjN1eghBwIIRxQpMcMONTyu8qsclb05/ENiTrzzwp2bT0KHCD12AhqngV04 phZDq/A04KoTqgxcL/cCcyxYbpBxOfz5/mVPg2F+aUWw14iYOrwWwgmLbC2kcGFYqvmB03 5ew5Si1KdRH4PTSdDbKSO05a2EjjHao= X-MC-Unique: Uro0HNl6NxeLhJxC19Rcnw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] scripts: avoid error in DCO check on empty branches Date: Fri, 27 Mar 2020 14:41:50 +0000 Message-Id: <20200327144150.15112-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If the DCO check is run on an empty branch (ie one which has no commits different from master), it throws an error due to trying to interpret the empty string as a git commit SHA. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Andrea Bolognani --- scripts/require-dco.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/require-dco.py b/scripts/require-dco.py index 9fe13823a9..ae94393319 100755 --- a/scripts/require-dco.py +++ b/scripts/require-dco.py @@ -46,7 +46,10 @@ print("\nChecking for 'Signed-off-by: NAME ' on a= ll commits since %s...\n log =3D subprocess.check_output(["git", "log", "--format=3D%H %s", ancesto= r + "..."], universal_newlines=3DTrue) =20 -commits =3D [[c[0:40], c[41:]] for c in log.strip().split("\n")] +if log =3D=3D "": + commits =3D [] +else: + commits =3D [[c[0:40], c[41:]] for c in log.strip().split("\n")] =20 for sha, subject in commits: =20 --=20 2.24.1