From patchwork Fri Jun 21 11:54:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 253196 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 0CBA02C030C for ; Fri, 21 Jun 2013 21:54:24 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Upzuu-000182-JN; Fri, 21 Jun 2013 11:54:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Upzuq-00017w-6P for kernel-team@lists.ubuntu.com; Fri, 21 Jun 2013 11:54:08 +0000 Received: from p5b2e31e9.dip0.t-ipconnect.de ([91.46.49.233] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Upzuq-0004lW-2D for kernel-team@lists.ubuntu.com; Fri, 21 Jun 2013 11:54:08 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [kteam-tools] Fix inconvenient usage of strip Date: Fri, 21 Jun 2013 13:54:06 +0200 Message-Id: <1371815646-8664-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From e5ea00c057f0541a1a9e319d3ed43700c44a0ba0 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Fri, 21 Jun 2013 13:47:49 +0200 Subject: [PATCH] ktl: Git.current_branch: Fix inconvenient usage of strip The argument to strip is a list of letters to remove from one side, not a prefix. This is inconvenient if the text after the prefix happens to start with one or more of those letters. Signed-off-by: Stefan Bader --- ktl/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ktl/git.py b/ktl/git.py index 28412af..3d6b3d3 100644 --- a/ktl/git.py +++ b/ktl/git.py @@ -98,7 +98,7 @@ class Git: status, result = run_command("git symbolic-ref HEAD", cls.debug) if status != 0: raise GitError("no current branch") - return result[0].lstrip("refs/heads/") + return result[0].split("/")[-1] # show #