From patchwork Thu Jun 12 05:27:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 358995 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 9909D1400AB for ; Thu, 12 Jun 2014 15:27:29 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1B2484B889; Thu, 12 Jun 2014 07:27:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sJh02FVErILb; Thu, 12 Jun 2014 07:27:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DD5784B88A; Thu, 12 Jun 2014 07:27:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 78AA94B88A for ; Thu, 12 Jun 2014 07:27:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ddJ+ZsXw+MKl for ; Thu, 12 Jun 2014 07:27:17 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f74.google.com (mail-pa0-f74.google.com [209.85.220.74]) by theia.denx.de (Postfix) with ESMTPS id 10CC24B889 for ; Thu, 12 Jun 2014 07:27:13 +0200 (CEST) Received: by mail-pa0-f74.google.com with SMTP id lj1so96790pab.5 for ; Wed, 11 Jun 2014 22:27:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IQLGLCxAaTbH4fyT0KGzch1JpziJjC9MoS5LVmwBWyE=; b=CzGJ/ALnCFyZuc4Yo0Lbyf24aeuSKF3Lj5dFrSxpo5/aVypiIDbpmlKMlAPRrNCBhW piBhPVFUAO2/MOqgCaAPu8gVv4SQucP20Ml5srkO6FGctL+IM3kivYYlFR/ycY+Lz5kg kAAGHrJmGH03C2IQlf/qwm0JDvvTxHxEaLbQOw434gcbu0a4/r4FURAPq3CHHzvk9N8+ 7IWDcKrCAnl0rQTULyyFgLOd2ugkzQJ72AE2DNzBbqBHWs1lHy8DG7WAwb/jh+3fFQz5 11yjBKicvSetStWqzQAfp4YXfVlh7pdqZ7CgHRRBenCGzgyCz8J0UIERzvQ4mZtEQGGe zopA== X-Gm-Message-State: ALoCoQnAD0nssXcIDjUXONqv3Hg6zDNKteFmFIaL7dBgVDP0JrbwDd25Y02LRrQUyn9lDU9Lm0wO X-Received: by 10.66.234.39 with SMTP id ub7mr7954907pac.26.1402550831624; Wed, 11 Jun 2014 22:27:11 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id t4si1683959yhm.0.2014.06.11.22.27.11 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jun 2014 22:27:11 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 6DAC05A4456; Wed, 11 Jun 2014 22:27:11 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 040BC22066A; Wed, 11 Jun 2014 23:27:10 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 11 Jun 2014 23:27:09 -0600 Message-Id: <1402550829-13141-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 Subject: [U-Boot] [PATCH] patman: Only apply patches when we know the original HEAD X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When patman applies the patches it checks out a new branch, uses 'git am' to apply the patches one by one, and then tries to go back to the old branch. If you try this when the branch is 'undefined', this doesn't work as patman cannot restore the correct branch after applying the patches. It seems that 'undefined' is created by git and is persistent after it is created, so that you can end up on quite an old branch. Add a check for the 'undefined' branch to avoid this. Reported-by: Masahiro Yamada Signed-off-by: Simon Glass --- tools/patman/gitutil.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 3ea256d..7b75c83 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -232,6 +232,10 @@ def ApplyPatches(verbose, args, start_point): print stdout return False old_head = stdout.splitlines()[0] + if old_head == 'undefined': + str = "Invalid HEAD '%s'" % stdout.strip() + print col.Color(col.RED, str) + return False # Checkout the required start point cmd = ['git', 'checkout', 'HEAD~%d' % start_point]