From patchwork Mon Jul 10 00:19:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 785975 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x5QqN3Dr0z9s7C for ; Mon, 10 Jul 2017 10:21:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LsVWX8b7"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wmUG8tlKVbnTxF8yQcuH1lPXsEv6JepPskRIwp18K1k=; b=LsVWX8b7BcrJ+50eUVVBueyKIy JnGasv+raqYpsILDfNrduDbkQjnNT9R7csAsFIlV7qqOkKOkZ0+KRbZj+tGE8E26GNng08ya8BONz UtaCz25nnx0yrmcYnz/WJzIPt6d3hCDKQeDq55dqrn3dPaYHOvLs/sd9pWhhlrRupWpI4/3LSlhjO 7u1xNF5z30soBKfTkvJ0n3oDwSNUaJmwLZiayKoTjjnqgtMv2j5/xMxqkccUrITjvEqtBWDH7kDm5 fZ1uMXo0FG89AV5SWnB3q6vvmRD/BgejL6fdSDbebv/xY1SrqX8uprZ5Ynvo37OSIW4mlcRNW3HnJ cYioMhPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dUMRV-0000Sg-DL; Mon, 10 Jul 2017 00:20:49 +0000 Received: from chaos.universe-factory.net ([2001:678:3b8:ff00::13]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dUMR2-0007Qq-Bw for lede-dev@lists.infradead.org; Mon, 10 Jul 2017 00:20:22 +0000 Received: from localhost.localdomain (unknown [IPv6:fd1b:c28a:2fd6::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id 275371870B3; Mon, 10 Jul 2017 02:19:56 +0200 (CEST) From: Matthias Schiffer To: lede-dev@lists.infradead.org, zajec5@gmail.com Date: Mon, 10 Jul 2017 02:19:50 +0200 Message-Id: X-Mailer: git-send-email 2.13.2 In-Reply-To: <9fad4778d3a473af19977460c001ad7b2b9bcee4.1499645991.git.mschiffer@universe-factory.net> References: <9fad4778d3a473af19977460c001ad7b2b9bcee4.1499645991.git.mschiffer@universe-factory.net> In-Reply-To: <9fad4778d3a473af19977460c001ad7b2b9bcee4.1499645991.git.mschiffer@universe-factory.net> References: <9fad4778d3a473af19977460c001ad7b2b9bcee4.1499645991.git.mschiffer@universe-factory.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170709_172020_592100_31D612A7 X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 3/4] scripts/getver.sh: include branch name in revision string X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org To determine the originating branch of a commit, a file called "branch" must be added to the root of the repository (similar to the existing "version" file used to override the getver.sh logic). When no such file exists in the commit in question, the master branch is assumed. Signed-off-by: Matthias Schiffer --- scripts/getver.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 215bb036a5..f6d18bb3a3 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -5,6 +5,10 @@ export LC_ALL=C GET_REV=$1 +get_branch() { + git show "$1:branch" 2>/dev/null || echo 'master' +} + try_version() { [ -f version ] || return 1 REV="$(cat version)" @@ -42,7 +46,7 @@ try_git() { REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))" fi - REV="${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}" + REV="$(get_branch "$GET_REV")-${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}" ;; esac