From patchwork Thu Sep 3 21:19:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Jonglez X-Patchwork-Id: 1356992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bitsofnetworks.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=3huFKSlj; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BjDJ06Gp5z9sPB for ; Fri, 4 Sep 2020 07:21:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=wCZKXqtewPhHDzrmPgPe+G0kkMdEyxE6CTOh0d7GbdA=; b=3huFKSlju3yQ0J+bDdTKln/xJj aYgeGgbRUhLXewrvEuds95F/za1/V5Cr3Vl6qKdjDqcmZ0IMy6q9Yf8nEdJ7keYgjpz9kP85Ak4Kn 7CNILV3qIJdZiPYWG7LjwvZEUe/IU+S8AOzj126klR3QyUV90IgLRC/eLUYPZYPFPcihDEw4gffi6 208hoaUgtIAPOZlAfXA/T2XLglFiTrj8zTl89vVRJjb+8WMADTVw4D5P3A30EWckihmEeWp4OEev3 2WjhTMNYAYvnVfPMrWGBFtXkQQpp4HGFgCMzxZBAgqFUYEXBjwRCJDOz2MyV94sG9lOejdq7HXEdM YW/HvqiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDwdn-0005xj-MQ; Thu, 03 Sep 2020 21:19:31 +0000 Received: from mails.bitsofnetworks.org ([2001:912:1800:ff::131]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDwdk-0005xI-SX for openwrt-devel@lists.openwrt.org; Thu, 03 Sep 2020 21:19:29 +0000 Received: from [2001:912:1800::5c8] (helo=localhost.localdomain) by mails.bitsofnetworks.org with esmtp (Exim 4.89) (envelope-from ) id 1kDwdj-0001g2-OO; Thu, 03 Sep 2020 23:19:27 +0200 From: Baptiste Jonglez To: openwrt-devel@lists.openwrt.org Subject: [PATCH 18.06] scripts: getver.sh: Fix version when running on local 18.06 branch Date: Thu, 3 Sep 2020 23:19:22 +0200 Message-Id: <20200903211922.654650-1-baptiste@bitsofnetworks.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_171929_056071_6FC8D399 X-CRM114-Status: GOOD ( 14.88 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Baptiste Jonglez Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Baptiste Jonglez When building from a local branch based off the "openwrt-18.06" branch, version computation is wrong, for instance: r6907+1154-7e15e21766 The number of local commits (1154 in this case) is wrong because it is computed against master. As a result, it wrongly counts *all* commits since the beginning of the openwrt-18.06 branch as local commits. The fix is to compare to the openwrt-18.06 branch instead, which gives the expected result such as: r8060+1-1238a22316 Signed-off-by: Baptiste Jonglez --- scripts/getver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 9175f411db..dbd3292343 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -26,7 +26,7 @@ try_git() { *) BRANCH="$(git rev-parse --abbrev-ref HEAD)" ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)" - [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)" + [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name openwrt-18.06@{u} 2>/dev/null)" REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')" if [ -n "$ORIGIN" ]; then