From patchwork Fri Apr 14 12:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E833DC77B6E for ; Fri, 14 Apr 2023 12:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbjDNMSu (ORCPT ); Fri, 14 Apr 2023 08:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbjDNMSr (ORCPT ); Fri, 14 Apr 2023 08:18:47 -0400 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF37B93F7 for ; Fri, 14 Apr 2023 05:18:45 -0700 (PDT) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-18779252f7fso9409562fac.12 for ; Fri, 14 Apr 2023 05:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474725; x=1684066725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mhyABzB19F127sXkh/fN/OWuVNaEINGwbxe9YoZbzNI=; b=oDC9TCSQYOD/Rb4zqyb2eN9fQDRIazL5OxmCgQ3biWOTVtTn9Pf7zKVp14mjsaVr4b 4xSFuhdRrgLgDGbUMMJJSqDSk8RavSTmlDlI/spzMCi4D5fd7YVYzgykci0izQ6370Cz m/DVeOxbof95bZthwQ5W5Im2NuK9bbhgl8ek9v14bnaHPMtAcEF2XP3pqXSIQdUhVbXP dgZk9Ew0GuFIxPMMYGT3bb38rSP1lbm9QVTf7zRB7FNJ/mnK5SqQ/PkXgTW1p/mnsJuB oHf8TYALapCWJzsFXA1At5s4109RYGZkqDF3RyxuyVKpyQ0d9yClow/jQfHpaAsQdLU2 IK0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474725; x=1684066725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mhyABzB19F127sXkh/fN/OWuVNaEINGwbxe9YoZbzNI=; b=AT8MV/1ltZMBra7hprYoApcs6sYV7xK3AcfgMVHi6pZPlIpbzcqNiIuCBe6fZPCesr ykKUTcu+tt8lvUwthp34aXB6ea56LfrvjhvumkdsAYCnGUvOT8HdUBA+W0wx50hm5DNf 3c1iSuinCtVF5FiTpeoEQJ/x7MnA+CDlqxN4v02GLj96sRW6wLM9IhdPmB5idFY2cb7G RbCtYZKrqgiUeVR1KEebNz7cDutcSOCmZkKktH3x7iSPSHRyRP3opzPF6MHeD11lAvHl M8DxRJKVUVb0rDAF3EVy1H4f9YjWv3gMhhz7rRnF6prQ5xuNZeNiiMelMaY07m9HcPFP Np+A== X-Gm-Message-State: AAQBX9e3+f1YpX5s7iiEy8qgQLClEyqLtAtSB7JOZqjR4SmrZe2u899a 4Ehnsz1idOqfJgRjMnwhrfH58zwCapE= X-Google-Smtp-Source: AKy350bH/h9Yw2iPbFomTgGrYxTA6hW1OP6I4j/vGy2tHtXAFXiasl7ZiDEKgEcrR2/ZLqaRSBUcVQ== X-Received: by 2002:a05:6870:65a4:b0:180:7b0d:2213 with SMTP id fp36-20020a05687065a400b001807b0d2213mr3663824oab.54.1681474724797; Fri, 14 Apr 2023 05:18:44 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id dt22-20020a0568705a9600b0016e8726f0d4sm1753274oab.3.2023.04.14.05.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:44 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 01/18] version-gen: reorganize Date: Fri, 14 Apr 2023 06:18:24 -0600 Message-Id: <20230414121841.373980-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Simply move some code into a `describe` function so it's clear what code is related to dealing with `git describe`, and what code is the main functionality. No functional changes. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 9a1111af9b..29d634a30b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -6,20 +6,27 @@ DEF_VER=v2.40.GIT LF=' ' +describe () { + VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) || return 1 + case "$VN" in + *$LF*) + return 1 + ;; + v[0-9]*) + git update-index -q --refresh + test -z "$(git diff-index --name-only HEAD --)" || + VN="$VN-dirty" + return 0 + ;; + esac +} + # First see if there is a version file (included in release tarballs), # then try git-describe, then default. if test -f version then VN=$(cat version) || VN="$DEF_VER" -elif test -d ${GIT_DIR:-.git} -o -f .git && - VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) && - case "$VN" in - *$LF*) (exit 1) ;; - v[0-9]*) - git update-index -q --refresh - test -z "$(git diff-index --name-only HEAD --)" || - VN="$VN-dirty" ;; - esac +elif test -d ${GIT_DIR:-.git} -o -f .git && describe then VN=$(echo "$VN" | sed -e 's/-/./g'); else From patchwork Fri Apr 14 12:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AB85C77B6E for ; Fri, 14 Apr 2023 12:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjDNMSy (ORCPT ); Fri, 14 Apr 2023 08:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjDNMSt (ORCPT ); Fri, 14 Apr 2023 08:18:49 -0400 Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C699EF7 for ; Fri, 14 Apr 2023 05:18:48 -0700 (PDT) Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-187878a90e6so7695112fac.0 for ; Fri, 14 Apr 2023 05:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474726; x=1684066726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YoxuHttwGlHpw0iLHk9kbmg5mFYOxafVOewfrSGopK8=; b=kyN/2MYMJb4/vFIq4TRAGz90pLOJkCn/tccLck8VdBK2bKOUZF7UIDqPU3PmuXQ/7P Q3ymv2ucr65mOxcsUEteKUr3RKfSNOkOL9mnRvWW2z7+3CMZs6HXbLe6dpzJJPXT0GFo VOeSq2Xfi7/hCTwVEYSm+EJ6ussWyAqetDeRCbWl5I3vEZ1Y/fbx3SqkAkhRKhrQ54ES 8NtOILQh+jEIudmiOZ75iV8k2KZ5gvVe+UOJKD5voikoWFsFq6lgc6s/m9vBpX8QnPEd JbMLEED0WwlqVKfnWurxUK1jsFWkGT843q4o5aXxhIPfSyt2aAL09D5fcE6LXloOcTWv /D6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474726; x=1684066726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YoxuHttwGlHpw0iLHk9kbmg5mFYOxafVOewfrSGopK8=; b=b7gps36mHewOMMVJbNLG8eLZj8957w2Saw9YHPfYnzxnyyoWSSCVEvG+2Js/EOsHds CeNq5zEQ5kBZnUtKJpDi/FfXjzKfYAxryXCyANZy6cTmataEKu8KtEK9pa1vQ8Qhrr9t 5+VgQrRpXm80dHdvPnTa7eoa6Jt3QM02UjqkD2cT+siUJIqEHoUOX0oNlqb76eU7/3Jn j0vA+X1EP0Flnl+CBAmD8PUKFE3nCiIkRAl0olGVu0gZjJzapWbnsbhOpbMfe16XG21R dGuXN7OSUO0uHVn9vo578q/T/XgznvIc7MpWz/S91fjqPUbV+NflKAkLKI6plnFaXxL2 bnrQ== X-Gm-Message-State: AAQBX9ctvxqAaeLmQx7xdQzdFDAFv6A+we3738otWd0b3Qp1/YxO/h5l 7pzC6Hk0KcxcMugFgsXTTnLh6et5QCk= X-Google-Smtp-Source: AKy350YEdVKieqVYpk7oYKvYZ0dQlodWyWS8QLigsMUr2pXjixTahgP/PQu3PAeLYcnt2j34rT3alA== X-Received: by 2002:a05:6870:309:b0:187:7579:76c0 with SMTP id m9-20020a056870030900b00187757976c0mr3317713oaf.37.1681474726189; Fri, 14 Apr 2023 05:18:46 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id b3-20020a056870918300b00177c314a358sm1718025oaf.22.2023.04.14.05.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:45 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 02/18] version-gen: trivial cleanup Date: Fri, 14 Apr 2023 06:18:25 -0600 Message-Id: <20230414121841.373980-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We don't use `git-foo` since git 1.6. HEAD is the default of `git describe`. Also, deal with a bunch of shellcheck warnings. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 29d634a30b..6dd7683ee7 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -7,7 +7,7 @@ LF=' ' describe () { - VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) || return 1 + VN=$(git describe --match "v[0-9]*" 2>/dev/null) || return 1 case "$VN" in *$LF*) return 1 @@ -22,26 +22,24 @@ describe () { } # First see if there is a version file (included in release tarballs), -# then try git-describe, then default. +# then try `git describe`, then default. if test -f version then VN=$(cat version) || VN="$DEF_VER" -elif test -d ${GIT_DIR:-.git} -o -f .git && describe +elif test -d "${GIT_DIR:-.git}" -o -f .git && describe then - VN=$(echo "$VN" | sed -e 's/-/./g'); + VN=$(echo "$VN" | sed -e 's/-/./g') else VN="$DEF_VER" fi -VN=$(expr "$VN" : v*'\(.*\)') +VN=$(expr "$VN" : 'v*\(.*\)') if test -r $GVF then VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) else - VC=unset + VC='unset' fi -test "$VN" = "$VC" || { - echo >&2 "GIT_VERSION = $VN" - echo "GIT_VERSION = $VN" >$GVF -} +test "$VN" = "$VC" && exit +echo "GIT_VERSION = $VN" | tee $GVF >&2 From patchwork Fri Apr 14 12:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AEC8C77B76 for ; Fri, 14 Apr 2023 12:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjDNMSz (ORCPT ); Fri, 14 Apr 2023 08:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjDNMSt (ORCPT ); Fri, 14 Apr 2023 08:18:49 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 931EEA272 for ; Fri, 14 Apr 2023 05:18:48 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-187a1387021so4081976fac.3 for ; Fri, 14 Apr 2023 05:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474727; x=1684066727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NcvgWFXKvgw9IRDZJw9QoZqVIf+9jTj1q270nYCiN5E=; b=k2VzKvNrJUNkgI3Euf1fOpgz44dH2pBlgRv4hT51otQxHfdVOR7evnLCvqU7BYXR7i s3FA7a6n6gCWctUN73l7FKAxSE8SoYfYIqi6eapAEu7kUaC1CooF25uRnAmJkTU8PtgU rtO8HiU1Tyg5EDRkY+INfETMD83xaLOhW8KkhZiJ1n1KiKgSP90zDvCyE7vyoBj6yB0S eKrYHvM9CoheG8AANAShpGRCHGeSICGQ1zSTgUaRKyufRZN8NrS3+sONYCdT8k82j9l6 X52pESpQ0g5UwQskZ2wGUdsWcbRAIZvEHR4uZb9DHVIFuLC82+WBIcK6AWKOeWv8ntKK WqZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474727; x=1684066727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NcvgWFXKvgw9IRDZJw9QoZqVIf+9jTj1q270nYCiN5E=; b=IdMNC9dDDC5BZPJS/I3Gac1gQR0g73VC1FaYXCaQW4Vpumz7vxglp0Y4Pcn0tfdJC+ Fmjf4S5lKl0kJXWYsKWm/LY1ZoJsZRCGBx/HvDUgECvnbXxKyzew8KLV0FuaMcC2Wu5K VcaYBPSvSsi5h0YxfbUfYoe8KjAxT/8Cwhah7guq9A9vgK4kLsbtZa4NKudy4KonlG8M TFi79ZXBZNqhitV0SJnT5DgGVLpzZIitbw5g7hgaLuV3ZxDy0eC7BzbSChkeNc90+Mfk uVTG7jeT8qqxbirPoqxU2tkFTgs+hNDa2qnzayWA79tKzecQzfbuYgcW1kVVlNlLWWK5 eb1A== X-Gm-Message-State: AAQBX9dOO80RnBmarDwBzyD6oBzQbPgvhVqD8iZMqxoFDwU7JphqOph0 ynPSqVAIFSmCRuV3sh1lwySIp3xVxMs= X-Google-Smtp-Source: AKy350ZA8ITQqvQm0X0dAg98eYbGGekC+u4Fvusv0wwuHlpLaTPTg2Of15R3eIfyk9o5eySXMHcJRQ== X-Received: by 2002:a05:6870:73cd:b0:187:8ab7:c0f6 with SMTP id a13-20020a05687073cd00b001878ab7c0f6mr3735132oan.9.1681474727647; Fri, 14 Apr 2023 05:18:47 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id u14-20020a9d4d8e000000b006a2cc609ddasm1645055otk.2.2023.04.14.05.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:47 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 03/18] version-gen: refactor default version Date: Fri, 14 Apr 2023 06:18:26 -0600 Message-Id: <20230414121841.373980-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It's not clear how `cat version` might fail, but either way if VN is empty (or unset), assign the default value. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 6dd7683ee7..0d00fa3d9a 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -25,14 +25,14 @@ describe () { # then try `git describe`, then default. if test -f version then - VN=$(cat version) || VN="$DEF_VER" + VN=$(cat version) elif test -d "${GIT_DIR:-.git}" -o -f .git && describe then VN=$(echo "$VN" | sed -e 's/-/./g') -else - VN="$DEF_VER" fi +: "${VN:=$DEF_VER}" + VN=$(expr "$VN" : 'v*\(.*\)') if test -r $GVF From patchwork Fri Apr 14 12:18:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75652C77B6E for ; Fri, 14 Apr 2023 12:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjDNMTC (ORCPT ); Fri, 14 Apr 2023 08:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbjDNMSx (ORCPT ); Fri, 14 Apr 2023 08:18:53 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08228A27C for ; Fri, 14 Apr 2023 05:18:50 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id t25so74493oij.7 for ; Fri, 14 Apr 2023 05:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474729; x=1684066729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SealYxV1P0U6WM8/BkNmOSbeoydiMVThybk/G9EJ+VA=; b=Ae/niNOGXHNj5f3hO3VkwCrv74d03r5dE+OvJKzOG0IJR8shVhBLmfF0wsSr+i81/B CinvW5zAbzwLI/8XrARmPItSOcNbj1nTUd4/rcb+qNqWg3CstXTUKQG6a1kghpnAfInW ekoGsMBw7uWIgNq7OYuRrB8kMR/JXG58hoYOVVaEY0LEgVrJiap7D5vzwcTGdWFtOUh6 PHrHYYO/DVAZAcgCY2oawop/1urKGb0TVOs6tKbPMBhE/xUtRbcRwPwHZudFZHDir2uw /R1xYKo9mQjYRQtLbsGmbsDwx7V6EUeUhXOrASwFtjumtHW+Pb77SRV93i6ZJhVBaq4H eJYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474729; x=1684066729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SealYxV1P0U6WM8/BkNmOSbeoydiMVThybk/G9EJ+VA=; b=V1c/ldb61AjFmxTWUPvPupmXtVjPO41dG3VeRFnDqNjRf3oBTirpp1yukKfCn8RAul 2L1L1GlnytHSFajHbjC9o3W1KQxi2ZBapKgRn5L2vuSTbG8ILTOLKG+AGNUDB1doOLBz 07tHEYnDt2eNa2tcbkk9us5BdG/hmp4/MNLmUoBgoy2rf/6USZbwOS0OxtMVJatJOuie p+/YfxLJDZHheRWfsr4Z26I+6mJGv1lBVK7fexXCvWwhcNcnajW7y6tu1R+jTm4s/97T hNAS+BYH1Hg28WgMIDAi0o7dbcSgiwBhqhKQUjQ4QV79SXJgUpGStcPnz/azXNguoWrG QInQ== X-Gm-Message-State: AAQBX9ex8G8dntTs8uOfT/lO++1VKxIDCWZa3uOUb6jCHkjfbyVmvN2R 4HmrGxy17D/ufbICV8AjIGYWeX/Yylo= X-Google-Smtp-Source: AKy350ZdPzjo3n+kNm2aG2WrO8HXrIjxktVLzAw50ous9R8aj8ITKDoRLfzIIXSYBw6Qpzgiqy5m0A== X-Received: by 2002:a05:6808:278e:b0:386:ee34:afb9 with SMTP id es14-20020a056808278e00b00386ee34afb9mr2344349oib.11.1681474729098; Fri, 14 Apr 2023 05:18:49 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id e131-20020acab589000000b00383d9700294sm1601171oif.40.2023.04.14.05.18.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:48 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 04/18] version-gen: simplify v prefix removal Date: Fri, 14 Apr 2023 06:18:27 -0600 Message-Id: <20230414121841.373980-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There is a much simpler way. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0d00fa3d9a..c0f6bb242f 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -33,7 +33,7 @@ fi : "${VN:=$DEF_VER}" -VN=$(expr "$VN" : 'v*\(.*\)') +VN=${VN#v} if test -r $GVF then From patchwork Fri Apr 14 12:18:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A125BC77B6E for ; Fri, 14 Apr 2023 12:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230378AbjDNMTG (ORCPT ); Fri, 14 Apr 2023 08:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230351AbjDNMS5 (ORCPT ); Fri, 14 Apr 2023 08:18:57 -0400 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 709AE9EEE for ; Fri, 14 Apr 2023 05:18:51 -0700 (PDT) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1879502e2afso5529685fac.5 for ; Fri, 14 Apr 2023 05:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474730; x=1684066730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UQcKAEYzHB9sfB9/cYFsqe1sV8FF6PP6yTX0Z7OGj9A=; b=Kx4JGlBiTSWqAJr6VXHxHNVb6QR0sql0LL2JygU1CUBHJjiiEdEg2FygYJUvugVOhT Fo+6vU9lV+lIR3o00USmJG9hX4gWU3c/xl8SIplozrEh28vg+hK3ME8Su6A8I6u7Yl3r EvcTHv98IDh9MGwWwU5dfSozT8LKYXFxk9XL0CwS8zez27ye5wK+0+agpJHPE1ldy3i1 pohqzwSkeY13Bq2G3JpV7+TazKJ67BkoC35o/NU7H9Z/friipjB6FKVKM2K78yKnHoZp RKFVp8aCUkOb5xLVTaDbrxE7R5pYKq74Jr+YgSDXaMsTOTmSxTKczsChWzX5N+6PrVdI XRQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474730; x=1684066730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UQcKAEYzHB9sfB9/cYFsqe1sV8FF6PP6yTX0Z7OGj9A=; b=b6UGdTDuebLy9WhY5lTz7nbs/l4F3vjiw8ibo1nx3DNVr7nmids9FUvxuf48ayc4Dd 6gCKXoiyLSvuXM0+TimVoxdPHBNgTNP5OPhhW4ocd4GNqd1+H4sfJBKnJ8+oDHv3Dv98 +WEC6lZOYBpnwLLxM+qohGdsfepLhOdtyBqQXDd2bQpdleWbC+oxc5tp065xQY+5sgRZ 1xGY5yvH4S/2h4XhhZTKZz+IEPZG9d+SCNOrM2jRdySf1tH/4WUb+Ro/hOtyfog2dEiu Kpj/e2BpvpRUbEKWGmtqMHTxj69eAXqVPExa1qaMAe8Z7DyLOC3vVYi4SCE2S0L2f6YR GELQ== X-Gm-Message-State: AAQBX9c4oWMhDoCXYUM12NXbAH7BW6AY5DPwPl2xa5oSge+jkXygDLxR 1+gjAmbx2z17HT80SHZr0p1+gTEkD0I= X-Google-Smtp-Source: AKy350aMwXX1w0CMf1CdF5qgbE+Xbkxfwf5C3FZBatt3OjDHrFEZlPOkT74Zu682VL3zU36t7oL6qg== X-Received: by 2002:a05:6870:a54d:b0:172:7fc0:9188 with SMTP id p13-20020a056870a54d00b001727fc09188mr4291001oal.35.1681474730433; Fri, 14 Apr 2023 05:18:50 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id 63-20020aca0742000000b003896b3269d3sm1590332oih.20.2023.04.14.05.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:49 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 05/18] version-gen: simplify update check Date: Fri, 14 Apr 2023 06:18:28 -0600 Message-Id: <20230414121841.373980-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We don't need to extract the version when we can compare the whole contents. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index c0f6bb242f..34f561752b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -35,11 +35,5 @@ fi VN=${VN#v} -if test -r $GVF -then - VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) -else - VC='unset' -fi -test "$VN" = "$VC" && exit +test -r $GVF && test "GIT_VERSION = $VN" = "$(cat $GVF)" && exit echo "GIT_VERSION = $VN" | tee $GVF >&2 From patchwork Fri Apr 14 12:18:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD230C77B72 for ; Fri, 14 Apr 2023 12:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbjDNMTK (ORCPT ); Fri, 14 Apr 2023 08:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbjDNMTC (ORCPT ); Fri, 14 Apr 2023 08:19:02 -0400 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E679BAD36 for ; Fri, 14 Apr 2023 05:18:52 -0700 (PDT) Received: by mail-oo1-xc29.google.com with SMTP id c17-20020a4aa4d1000000b005418821052aso3644765oom.6 for ; Fri, 14 Apr 2023 05:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474732; x=1684066732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qUueyUODtySalWhFKFLZhvq4KkQvjtEEmGE0WXCL7KQ=; b=btDIBS+ZEthug9vhWe74DGi+iK8Cd+BvqsyxIRQVAZJ2VhRRElc84fpeTbXLDpSXs8 nn8lYnYAvC2YC93Q3X/CmtcQkLDAdT8dT5u/U8KhYldoS4+6gB3KIpSMKmzXL3z7ROia FND6IeR0BE9nvCd0vxGN5P3qy7arA6V0rRYic+QbUUK5HftMEKjJJdcVWG5KAXwm9s6j KcLgFmmSFhAtUmWRyD/yUARvahStUnNy4n1/N0+xSpvE4DsckK2pNtDcuhn/65KYcmDq I+6xLms9XKHeIJcWAysafSjq9a9GwTZitCZp2QXQPWIsZO92NWlDyWcHQ062cBtrhMiG qp7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474732; x=1684066732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qUueyUODtySalWhFKFLZhvq4KkQvjtEEmGE0WXCL7KQ=; b=AY/SZRo+9iNXU/CybmN3quY1Lmj7n/sGrALNGd6XQpj/dXCrbREC5Ya92fjLYhzwJq JjmjOOOAAU4YCWX3WHvAXBErRhDvAUPTbe8DSOL+TElfxjfiDo16IXalCjvWnnB44FTF 2vKZvWi3GpKa7d21n49uJfrY9I5AgkHwYD9jewlDHB3rMVtYr9VDbS+RdseZimVVk1fv sOIT26sinxA34EbPNuHT2/T56aFm1ySpe8XsgR0vKBi8bvpdXHNAGe3akVBmZgSBpG62 ttZgtNfAP9wBIDpz32hFPUWT+UNsBri1bjHCOLL0tOZ/CFCleYsOs0Aw+nL07PBX54Lp ewKA== X-Gm-Message-State: AAQBX9fm6qVCuAnrQokavifWWntvkOyvfm1y72esfZKxHdH8qp3X5fFa LLyGOBUJ0FbKwi7cC3j8/eb5DhFJqQ8= X-Google-Smtp-Source: AKy350bqjT/C73LCBF+U5EMayWxuLv2zw8btuyYNlWDuxpWUPq4HKAw2jZGBlpDT9kJQVSaJVG9NbA== X-Received: by 2002:a4a:3711:0:b0:525:58f7:cbef with SMTP id r17-20020a4a3711000000b0052558f7cbefmr2409266oor.2.1681474731917; Fri, 14 Apr 2023 05:18:51 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id r7-20020a4a83c7000000b0054156478f2esm1596952oog.44.2023.04.14.05.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:51 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 06/18] version-gen: remove redundant check Date: Fri, 14 Apr 2023 06:18:29 -0600 Message-Id: <20230414121841.373980-7-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org If we are not in a git repository `git describe` will fail anyway. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 34f561752b..cd94a7902e 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -26,7 +26,7 @@ describe () { if test -f version then VN=$(cat version) -elif test -d "${GIT_DIR:-.git}" -o -f .git && describe +elif describe then VN=$(echo "$VN" | sed -e 's/-/./g') fi From patchwork Fri Apr 14 12:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12DB1C77B6E for ; Fri, 14 Apr 2023 12:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbjDNMTJ (ORCPT ); Fri, 14 Apr 2023 08:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbjDNMTC (ORCPT ); Fri, 14 Apr 2023 08:19:02 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA869A26A for ; Fri, 14 Apr 2023 05:18:54 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id w19-20020a9d6393000000b006a43ff0f57cso1010976otk.5 for ; Fri, 14 Apr 2023 05:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474734; x=1684066734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4sTu8DDDcKxqs8OHsyqf7ijd1kHrvKVRJsUQq6XeabE=; b=eVo7o5QRXNMBU5JOKvtkZa4v9uGZ8tdE2YNb+0CV3/p5JtZ2ywWYzXBHYFlX/wJwIv tqePiV9foKDGavRcDW7+ev+Go2chNqilTT7hoNjOhrRfkBQtsbPkmBKtB1ZNAPytEzwv W3PdFW7P1QJ6U92L5PIrjhWx/2E3CvJ/CjF9zmDnJPGh7N6LqTvGLUVQTts9Kom2Kkcd tHXqt77yBP9Pi3DP5FXGlr7k20D+W5YwWDMDsLbLYlcrW4029uubJvdIyFlciaFTvRSI 2x9Qi+PVHiNgnEoV4TemAi/1f/AX6AhTdKTtPkTPq2phneDAdv0R3jh9AkumWods9N0L iGwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474734; x=1684066734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4sTu8DDDcKxqs8OHsyqf7ijd1kHrvKVRJsUQq6XeabE=; b=T1VfvYTvZpMKvgK0uHQyHT12C8ULgkjyciDHxwtEUsVTThvHVD/HuQaSzhss+AvO1H jlfbk1oCz/rKtpYz5KCkT9zxRufYKEI9tNN/aV0yHvaO0VjRke00ixl9za++oKLSV/tC vO+zBjC2D+KZmAADF4SktLuA0qa1MOkzBU0gVBmj3cBHShNykDkk9qF6zW2wUUF1stzr k6BV4iyS0JKtkEZJ1PU+7kwMrS2Znlpds5v2XGZlm9/fFPVIzoNHEmeOr9A+YTBbFR/P cdjY8/MHT6jTzvaYhKiOU2wl3n4hGe3RyptEa0HamGYAGY51S0TXS+dbDPvIwPvIfnTM 1sCQ== X-Gm-Message-State: AAQBX9chHTIE0wCy29qYBfbVMZkabQgIArZePHW+qnirLBhqz9vdeVKX WgP1pzBTCY06KNifAR7ba807ah0u4Zg= X-Google-Smtp-Source: AKy350Yrwxev/6nzMIAV5TT58j1MDaSyBoziZiiYyELcoXQcSs620NaGIFV9t4eVAHKUiM8lSSVL1A== X-Received: by 2002:a05:6830:18c5:b0:6a1:3dfc:4e44 with SMTP id v5-20020a05683018c500b006a13dfc4e44mr3037087ote.27.1681474734011; Fri, 14 Apr 2023 05:18:54 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id t4-20020a9d7484000000b006a249e69aebsm1574627otk.81.2023.04.14.05.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:52 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 07/18] version-gen: simplify `git describe` checks Date: Fri, 14 Apr 2023 06:18:30 -0600 Message-Id: <20230414121841.373980-8-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org How can `git describe --match 'foo*'` return something that doesn't contain 'foo' and without error? It can't, so no need for check for the impossible. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index cd94a7902e..0021e88cdc 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -3,22 +3,11 @@ GVF=GIT-VERSION-FILE DEF_VER=v2.40.GIT -LF=' -' - describe () { VN=$(git describe --match "v[0-9]*" 2>/dev/null) || return 1 - case "$VN" in - *$LF*) - return 1 - ;; - v[0-9]*) - git update-index -q --refresh - test -z "$(git diff-index --name-only HEAD --)" || - VN="$VN-dirty" - return 0 - ;; - esac + git update-index -q --refresh + test -z "$(git diff-index --name-only HEAD --)" || + VN="$VN-dirty" } # First see if there is a version file (included in release tarballs), From patchwork Fri Apr 14 12:18:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 244C8C77B72 for ; Fri, 14 Apr 2023 12:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbjDNMTQ (ORCPT ); Fri, 14 Apr 2023 08:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjDNMTD (ORCPT ); Fri, 14 Apr 2023 08:19:03 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84AB29EF7 for ; Fri, 14 Apr 2023 05:18:56 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id ec6so5162960oib.8 for ; Fri, 14 Apr 2023 05:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474735; x=1684066735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JbCi9XPr9DESQfzQE6XslMYNVOqL92PE+o6ZiXHbhRw=; b=IOajNvnyN3bFG6j5NUWS7SuN1V2Ez9pFCMJzDFkF0pbYeDTNxGH6ysHIehY9HNHxlX 0MUUXsA4gBXbAMVvCMdS7h5Vrmfc4MfG+GDcBHY1K4I90qmr1OtIrgRZUZlxIW+EOq/u Yn2IL23W9XzsD3JOHh87B5urGF0fQwTTQPY5MQtCByOkrRDU2xJeO1sYpQHSqekkmMRR bGi3Vt2WexUYixGVu3t1rWk5pPK2gvCZGwn11l1xsboNgbWaSQItBxD8NDxe9TWC510J 70HdY2SruOCVaAe6k9rQy/u0uyG16kl/Dijy9aEg59h/UuToyOXU35sZkGftGHbo+Bzw 5asA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474735; x=1684066735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JbCi9XPr9DESQfzQE6XslMYNVOqL92PE+o6ZiXHbhRw=; b=lQj6DMEUbrhA3A+mwUI75jdMfaWHLudaDK7hrMCHw4cIhos37SdEg068d0bSXWIAWt vD31hoISZpRiLlRAw0ci12yHPV5JvAdd28x2xLwqpKyeriGIvO5r6T/WZxBouuOdpve+ 8VyYzh/n33ymECdwLjwPjRUkcFsP4+REH1VmqW0lNK0M4KSw3Ie9v4WdYzsz9P3/AtNh O0+FyQ+W7J5Q5Ys3h7a371zmLUgDirl4m0ZT/G85S9q8+0wXibjlQrKxSa44+mAXYxGL OpKJaQc7HLjLsCjzifj19xalc0zJIouYyS+u03aNy3VW1YTFz4wjP/sDMfBP9dKtCENK FCjA== X-Gm-Message-State: AAQBX9cX/5nW0yB+YvM9brjJwPmrazdkkMKAGjFE8CMB3iiYLS0WwlbC HdowFB6N2b1MPbdvmeDki/cY7WQmnYQ= X-Google-Smtp-Source: AKy350Z7WrKoeFYk+JEotZ+UiUpIQltsyAAMM+fCrnJvHLSsOdve3sCqaAThwHpR27yhFwhlgttMAw== X-Received: by 2002:aca:ead6:0:b0:38c:9f8:e6b4 with SMTP id i205-20020acaead6000000b0038c09f8e6b4mr3636192oih.21.1681474735622; Fri, 14 Apr 2023 05:18:55 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id bg15-20020a056808178f00b003896f132821sm1587169oib.41.2023.04.14.05.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:54 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 08/18] version-gen: simplify dirty check Date: Fri, 14 Apr 2023 06:18:31 -0600 Message-Id: <20230414121841.373980-9-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0021e88cdc..9be9e14204 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -4,10 +4,7 @@ GVF=GIT-VERSION-FILE DEF_VER=v2.40.GIT describe () { - VN=$(git describe --match "v[0-9]*" 2>/dev/null) || return 1 - git update-index -q --refresh - test -z "$(git diff-index --name-only HEAD --)" || - VN="$VN-dirty" + VN=$(git describe --match "v[0-9]*" --dirty 2>/dev/null) || return 1 } # First see if there is a version file (included in release tarballs), From patchwork Fri Apr 14 12:18:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7626C77B77 for ; Fri, 14 Apr 2023 12:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbjDNMTl (ORCPT ); Fri, 14 Apr 2023 08:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjDNMTH (ORCPT ); Fri, 14 Apr 2023 08:19:07 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC4BAF0F for ; Fri, 14 Apr 2023 05:18:58 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id l13-20020a0568302b0d00b006a416ec44ccso4553802otv.2 for ; Fri, 14 Apr 2023 05:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474738; x=1684066738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QTAA+7jqrJLO/wanC1ao9XXl8TbjsexwwaouOz/Yq2E=; b=slL4g13W2dSh5Ffj40+4HvR1T2oTJFBCSuguc4Haso93Ogc2wWJkR8PECdTx+lvF70 kSEFKMgGnYiQffin6uxleeUAGpEho3xYgFEsVSqSXAXR0iSxReYyFKt43CRGA9guqVhJ QpkhnEAQbj9J61+w8LVqvK9trpPIGY/ywD7SU43piE+5qgjmts3J5V5YVM0C2j6lzpBh FPmhU6jBHppAx9wL6T9NdZXR3wjapdPreeYKOBYgCehCL9TcG3U60BuHgPslaTaMaoMH U39ioPt10/IR1nJ6+sgLLOps+WbVv+hdk6C/7qM4wJ+jZbVvr+eYb/siyKG2bdzfqAl+ Op1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474738; x=1684066738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QTAA+7jqrJLO/wanC1ao9XXl8TbjsexwwaouOz/Yq2E=; b=fUEYz47c7Jdl0jC8H2qy4LmDZW4obDEnKGG3NiXDVQ2R+sq6l4AgNO7oCKd5xVuZub KCVWH+Zo+XFNUUKQ7Qli+g/L/S5JO+YNBGJ6WmCYetvjf9TFN4rERF299+vfFPHmdggz GOcbrZy/fplOEeSaW7g1f9fpog2sWEItXeY7jQ/MCe6PXgccp+2aKbHWp6uxiKrS3X0g jQF8xBRgQyj5TM5+Z4jQ2Lc6GKgI88BB2xZUnCAuIRZhnBQamh2EROPJrYK3rCQUldnS 97E87d+d6/NowCnSA7/LPJ5ez6At/Gfy+BTWfoX1z0WT65AMZDlG65NBABvOjU0NAgS2 jigQ== X-Gm-Message-State: AAQBX9cv2+tkb4VkRPdRdO7rrrolnaG0HbyEEtKqqeSqyWGfVEOAW+Ob 8x3AiVyg1iHp+X0H0pALT1DQ4t6pUGU= X-Google-Smtp-Source: AKy350baQMkWZRyYnegJ2gwTtp5fWEOlgNPNO1osYqvW6nLJKqxoGzkSZDf9kGOOA9eJbjr70wsOOA== X-Received: by 2002:a9d:68cd:0:b0:690:bf1e:9eef with SMTP id i13-20020a9d68cd000000b00690bf1e9eefmr2873413oto.21.1681474737903; Fri, 14 Apr 2023 05:18:57 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id z18-20020a9d62d2000000b0069df7242a08sm1664988otk.26.2023.04.14.05.18.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:57 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 09/18] version-gen: move describe fix into function Date: Fri, 14 Apr 2023 06:18:32 -0600 Message-Id: <20230414121841.373980-10-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 9be9e14204..b7d2b8758e 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -5,6 +5,7 @@ DEF_VER=v2.40.GIT describe () { VN=$(git describe --match "v[0-9]*" --dirty 2>/dev/null) || return 1 + VN=$(echo "$VN" | sed -e 's/-/./g') } # First see if there is a version file (included in release tarballs), @@ -12,9 +13,8 @@ describe () { if test -f version then VN=$(cat version) -elif describe -then - VN=$(echo "$VN" | sed -e 's/-/./g') +else + describe fi : "${VN:=$DEF_VER}" From patchwork Fri Apr 14 12:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC6DC77B7D for ; Fri, 14 Apr 2023 12:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbjDNMTp (ORCPT ); Fri, 14 Apr 2023 08:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbjDNMTH (ORCPT ); Fri, 14 Apr 2023 08:19:07 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A442AF32 for ; Fri, 14 Apr 2023 05:19:00 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id bu14-20020a0568300d0e00b0069fab3f4cafso8608195otb.9 for ; Fri, 14 Apr 2023 05:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474739; x=1684066739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=soR+1ypC2E+7I8G+THTcY9msjZ7MRLONoIcxNIyOs1c=; b=LExe9IoQuF/jGi+t9VUND2qItfsYADFG+1NkGzkTe/M3G5AZBBEWJGiBVepyWH3Pp9 8Dr8AnVP1LIJUbxPOxW/L+fE6931RHxTM9tkFfD6LPeI8Lyz279eL2bSyvoZUsU78jZ9 xR1XL9eDFmBFH27k8d74hO5qVKD9Fv99lcno8yckJMIupUkmFAXzIm02xTL3qf+GaqAi SRO9CG1AbZssVE4xXBI8FvxNztwWfsHr/Iz75phtkhCyea8i2ar7jBBfFXZ/AMaqt9v+ nleCHwnKwABpvo387ejJWTLN2wG8UFx+ZBjtZAZc6kkJREkYYChiioIcIoj3rARfnGlj 3+Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474739; x=1684066739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=soR+1ypC2E+7I8G+THTcY9msjZ7MRLONoIcxNIyOs1c=; b=UiT2xB+VW7oFcvsdKyyRMpHM7hE1pFpfNrKWhOqNrUS4Nofrc1RvYIfmOnZ+iZ+yLX 3fVCDVGRIYJnnO422ol8KP/yWCJlfDGxwa2cq5lD0XP9eZI+jIZg4VqBvpkQmCC6HpUC LynTNIDPlk6Xz7MYnUxaOndEforHXgDwpdRBxzLtFK+Cxl4KYZ6iRvuqEhrsFu8DKPLL iTvWK/mXuaoUo26w7XGEBoirp1CnX4D/eziMHVZxyE4L75C3FGW9i45QK7A4IaPvAF2/ e+9d76nO0rqATtriD8p2/UWbBrmzLZZiVBRIX9GnknykN0uymV6dkFY8G4h4LW2j3G/v zppA== X-Gm-Message-State: AAQBX9fc1yXCURSCJeZ7Ar0FNnrTwc1cV/JQCG/hRMMYE/pLC1fkAV+R pvgGdx86PKjFavgOFh34anS38eeb1u8= X-Google-Smtp-Source: AKy350Z06Gvt8GSndmUQMN8ExlDSi5qpn8ml/UHcBwYuC3kytLJqC8mgMgQ7/ctw5usUHjiMAQRizA== X-Received: by 2002:a05:6830:112:b0:69b:98a:30ba with SMTP id i18-20020a056830011200b0069b098a30bamr2658834otp.2.1681474739511; Fri, 14 Apr 2023 05:18:59 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id j23-20020a9d7d97000000b006a332cb18c6sm1626044otn.17.2023.04.14.05.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:18:58 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 10/18] version-gen: describe and sed in one go Date: Fri, 14 Apr 2023 06:18:33 -0600 Message-Id: <20230414121841.373980-11-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index b7d2b8758e..962b9441e4 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -4,8 +4,7 @@ GVF=GIT-VERSION-FILE DEF_VER=v2.40.GIT describe () { - VN=$(git describe --match "v[0-9]*" --dirty 2>/dev/null) || return 1 - VN=$(echo "$VN" | sed -e 's/-/./g') + VN=$(git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g') || return 1 } # First see if there is a version file (included in release tarballs), From patchwork Fri Apr 14 12:18:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA348C77B76 for ; Fri, 14 Apr 2023 12:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbjDNMTm (ORCPT ); Fri, 14 Apr 2023 08:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbjDNMTO (ORCPT ); Fri, 14 Apr 2023 08:19:14 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE863A276 for ; Fri, 14 Apr 2023 05:19:01 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id j12so11937022oij.3 for ; Fri, 14 Apr 2023 05:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474741; x=1684066741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UKQO50fjwdowKB4LaZ+2+KV3xegteDBZTkDGHkBbUvo=; b=sbRZkJ7wuUOKkxmQM1VSImD+AfWmsKdFvagrTwEiZ0agEm+k4T0zg7IkXULCd3dVVe 9WnlBh5D2xCJdJwt34m+HEYRjIZnRY8aisPQKVVy3hKZcGE1O3Mjs9NP95J1jgQ33cX9 lYthzOB0NJucFrJRjmXWt3asE1Qw1mcDy50G2U0Lcr/K8UFEY/dHdVBXMRhMc85qIlA+ K2xlAkKHRf/LibpmaDC/Ls5WpWSqv0ddr808YXByPxeAZ7re0PeCgc7HgDR1G9qCOAQU I6UsxV6n6037Sg5EHSuyCZivSCoaNAU0HCRBaGpqWGV9m/cnQ3SCjOjmQJfhx9ImUTDI f//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474741; x=1684066741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKQO50fjwdowKB4LaZ+2+KV3xegteDBZTkDGHkBbUvo=; b=OwObwM7o3X19mwHEf2isTFxQOB36GSvFBvRqCNKlaVf0viKYrfLpTtdgMP2Y2oP0va FH+SKuUMBc193vxdhz/+cRClsmLTPTA2qAYkrloNtZwQyxC1LmIYMU/cG072bhWlUUdi gI6AXrFFJIc4Z9v6bVqOXkrxw9lbVUf2UsFPsmNREHvT6ppn/bTJUGWnPT5P8dCPeOUe CdRsZAOMaOE35sjQXs5qcc69Y1d5vkCGo5d8sZgtWZf0XjFahWyc8hqvXcg2bCaxG/OP XyULDISwyFADIFRuz5SwikWuq2iJAr1IBRowRzu3ibrnKrIlic2leIib7Brx0SdsTbzY Iqpw== X-Gm-Message-State: AAQBX9dJkc0lfEtm0kx7DD+mfWI5nWlHKyZV4PdNNesS7bMI3nrHSY36 +xm4+KFondmxSWx2K93hrOghX1jzCkE= X-Google-Smtp-Source: AKy350Y3C3Z8wBA9OdQSpQZConqO0OJIfFj1MFNmocBw/I6FfF2VpsaZRRgh0SEFT1fduDjuq5/dlw== X-Received: by 2002:a54:4892:0:b0:383:f66f:6276 with SMTP id r18-20020a544892000000b00383f66f6276mr2637000oic.0.1681474741042; Fri, 14 Apr 2023 05:19:01 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id n1-20020a4a5301000000b00541b86960d8sm1626037oob.24.2023.04.14.05.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:00 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 11/18] version-gen: refactor describe function Date: Fri, 14 Apr 2023 06:18:34 -0600 Message-Id: <20230414121841.373980-12-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org No functional changes. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 962b9441e4..d4de540249 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -4,7 +4,7 @@ GVF=GIT-VERSION-FILE DEF_VER=v2.40.GIT describe () { - VN=$(git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g') || return 1 + git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' } # First see if there is a version file (included in release tarballs), @@ -13,7 +13,7 @@ if test -f version then VN=$(cat version) else - describe + VN=$(describe) fi : "${VN:=$DEF_VER}" From patchwork Fri Apr 14 12:18:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAEB8C77B76 for ; Fri, 14 Apr 2023 12:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbjDNMTq (ORCPT ); Fri, 14 Apr 2023 08:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjDNMTP (ORCPT ); Fri, 14 Apr 2023 08:19:15 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B409A5FF for ; Fri, 14 Apr 2023 05:19:03 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id bu14-20020a0568300d0e00b0069fab3f4cafso8608256otb.9 for ; Fri, 14 Apr 2023 05:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474742; x=1684066742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ti6xZ4a/m+5AGfIdRU2re7/IOM+gLDppbWJUnk5WpBE=; b=CDcingrCERcdhiU2feF0J02YS6sAyeOf5lbUsYuPxu8m8XqloT1KjT2MyLPV8VJ7hl aOqoVTF4TDMFpuZaHnosGCy+dv1DdxbfLqb5upBet2YsthS1s+oGgZbTF8yeXocVskFe KZbubY04aE1pcFytaLPmDaP//XFtP090blM/RH73WS4EinKPBYU2i0P8PR/OJ+yUV+FR yP2nBleGFFBlGMO+4EAwSN8y7Je9Q+xEhqsUlSoiaBWNKMrZUgFaaeW3HwGuBgzhEtlG dY9jwcB98Yyn+u306zjkyAYXYt/rOiZlzmyypxoJQN+FJOkiILGTy2VXGo0r0/ozKiND suSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474742; x=1684066742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ti6xZ4a/m+5AGfIdRU2re7/IOM+gLDppbWJUnk5WpBE=; b=HjoQR+JRPsNE9iEVjIZl1Ui22U/ri8eHz6ytzC6Spkh3Zoc+Oh37V03aqPdlPBDpIX k+L8frDM7/z4sn52dRyUefcRPvkpSTw76JE2NnRPrrBJ4Eee3ZbJPLPt7IDUfUtWaxad Ii1mV68QJxlKy4qd4AgYZfPAKpHgw8LVXeuExrK6koz7qd7+rr20xDLGAjP46zUuLzHx NXebd2PWNrPEUNcRhGAmk+0O6wHc5A+2rvX7lYhST+vNiUj2N3Hbzy9Pm4O/mUPl+N00 Eheg8cTYYP/T5DKTs+M2uKDDpU6svOpuIgj1AW3sh8K+V0o0MobFCuY78mtmWc2Y1GbU btNQ== X-Gm-Message-State: AAQBX9fFPYBoEwNosjeVSOhbjOlUhPOMw7OrqFHyeXSo0tmeCwu1x1D5 2V8oIWuPkwBVMcBu6NL4m5Zq0jsS7Vc= X-Google-Smtp-Source: AKy350YH1PEHSpLOt3JeogXmJx0neklhifdgetzN34OObj5t6/dJK+YEumO8nKBUzME+KdV+z7FrTQ== X-Received: by 2002:a05:6830:1652:b0:69a:5407:e563 with SMTP id h18-20020a056830165200b0069a5407e563mr2652573otr.16.1681474742597; Fri, 14 Apr 2023 05:19:02 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id r5-20020a9d7505000000b006a3bd777dfdsm1636686otk.12.2023.04.14.05.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:02 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 12/18] version-gen: do v fix only when necessary Date: Fri, 14 Apr 2023 06:18:35 -0600 Message-Id: <20230414121841.373980-13-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There's no point in having a v in the default version only to be removed. The only time we need to remove the v is from `git describe`. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d4de540249..0691f481e4 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.40.GIT +DEF_VER=2.40.GIT describe () { git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' @@ -14,11 +14,10 @@ then VN=$(cat version) else VN=$(describe) + VN=${VN#v} fi : "${VN:=$DEF_VER}" -VN=${VN#v} - test -r $GVF && test "GIT_VERSION = $VN" = "$(cat $GVF)" && exit echo "GIT_VERSION = $VN" | tee $GVF >&2 From patchwork Fri Apr 14 12:18:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 863F2C77B7F for ; Fri, 14 Apr 2023 12:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbjDNMTr (ORCPT ); Fri, 14 Apr 2023 08:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbjDNMTQ (ORCPT ); Fri, 14 Apr 2023 08:19:16 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F57A262 for ; Fri, 14 Apr 2023 05:19:05 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id bb20so6972841oib.12 for ; Fri, 14 Apr 2023 05:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474744; x=1684066744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hXrPfLnmJSR6yRmMzk2YxqZceSYiIw+wWWP0ujdlVsk=; b=LH8Y8uRDLo+m5H6rNnum5EVoTX8nGShpGQdmMLDSwHeyGmnwm9QUX9jkRGCGhmkoMG SFFoQYYXKrDh1InmE98FRPzuFTImIuhy2iV17NvwklUxEBQ3iqbWV1CziAPBXutnBNEa BlWSjNFjk1JJnYwu1cWVQbIMfrwaWk4XO2hK51uzBqIsG8n1Odfp6NkCa8sQb9Ci5azq /11Fk4A6U+iJtYCB5oxhHWPxkzKvm7Usq2PI7pgkGF/wfIMjDX2QVtPhjjkvBQZWWvqS nejvmDirIrZiqYXUimv02lNs2x6aYTyQls3dso1/LoK/k4d884ceZT9WnQxaUrg2UEqs 3eZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474744; x=1684066744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hXrPfLnmJSR6yRmMzk2YxqZceSYiIw+wWWP0ujdlVsk=; b=VZjsgBsP8tg4r3xRH2fVZgAaSWgozuTupHRVWTDENH72lk2Ld2iaqzGgaIB5OlxLAT mr5hf87yUN7N/57pmAhcQooU/b/AV6tnooxe7uprSl1lBY45qJU0ozrPuDff1cMsUiR2 tWnhQSqifn3x3Y9EJrcDsEzSDzRUCzIb5L8zCXeT12Mbz+wFFLEd/+zW/J/wSuszs40X 5p9HAeZxEhnoj3VOIx1v0z2tGABCTgFwaE41gPASxuG20tSMlVEvXLz/pXEOwmQ7PQ4u Cc61HNuA+snh7298hnfEp0x8Oo7Z+twF683cd5Tezgh8ErPOyiRUmj/rycgqauTfEwi/ 12/w== X-Gm-Message-State: AAQBX9c3t+nwFDlXujZ1eIRsKlMGCP0n5G9mvCzokAYzZgQC4mvevzlk Ftj7HbILU2DDK5hQqZhHjVbgzv2prRo= X-Google-Smtp-Source: AKy350YcbkUi3f+w/cinvCaYlxk1HcyXKuspysY+q/e+6YwrCEC4CYchiI1wvS8FFyDQCm/siE38ig== X-Received: by 2002:a05:6808:3086:b0:38c:3ec8:83aa with SMTP id bl6-20020a056808308600b0038c3ec883aamr722125oib.44.1681474744081; Fri, 14 Apr 2023 05:19:04 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id v3-20020acade03000000b003646062e83bsm1593884oig.29.2023.04.14.05.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:03 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 13/18] version-gen: move v fix into sed Date: Fri, 14 Apr 2023 06:18:36 -0600 Message-Id: <20230414121841.373980-14-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We are already using sed, might as well take advantage of it. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0691f481e4..fa0e72a32c 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -4,7 +4,7 @@ GVF=GIT-VERSION-FILE DEF_VER=2.40.GIT describe () { - git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' + git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//' } # First see if there is a version file (included in release tarballs), @@ -14,7 +14,6 @@ then VN=$(cat version) else VN=$(describe) - VN=${VN#v} fi : "${VN:=$DEF_VER}" From patchwork Fri Apr 14 12:18:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0956C77B72 for ; Fri, 14 Apr 2023 12:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbjDNMTs (ORCPT ); Fri, 14 Apr 2023 08:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbjDNMTR (ORCPT ); Fri, 14 Apr 2023 08:19:17 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8697BAD28 for ; Fri, 14 Apr 2023 05:19:06 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id e80-20020a9d01d6000000b006a43569e458so2018490ote.10 for ; Fri, 14 Apr 2023 05:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474745; x=1684066745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HdCFWIPD/Xya/EAncT1NEKTkVPi/mTd9BhjKB2sKeIw=; b=cAlrP7caJs1RiWp2wZglyOC4ua4+pam2qacRN5IW7k3tWvZpur+svWFQLh98LXYcr7 IJVhFE7tTvnx6MOjMxwAC7dXrQtvxO47JDHmg801u+gkwpfWCs4cjd7ugeal61bVTaLm jN/cmYo2+F+QxQoW6/mVHDNi0/uxUppDW2aC2DxENWYVrgBdAOccnEYJhyBqBt7k5v6Y sbQLeFrely9Oz++k7jjmcUHPlGXE9AAgAf4bObrgq387BagnpleGRxsfF+vxehxOYT51 rh+rePQCWLtRyf4PqOtc4YL2cWUny2fdc5VAy8lKKb8UjXuV6pffgoEv40lZHRVnd8Kw mPzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474745; x=1684066745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HdCFWIPD/Xya/EAncT1NEKTkVPi/mTd9BhjKB2sKeIw=; b=RN7xeLFFi7lVK6n8TIPJFa/l5Y4wz+JMjFGGV2boF0N748pk0WArI8wfxJTI+7WGle Gv3mtz3oFea93a3iqYPyQCq7a0ghtm3l8+l1ILv6olwlEXLf29ZVelfIYU+JLJbXPhKy WpaalpURH7TSvXmktgJ4NdjPjOvupxmhJGyW6UCMDqBpTE/OgVXwESA68aepyOfLSfJJ qfupqNscAmHsU5ZFtk09m1UryQlPDHtxEK/OmrcLFwOdwyhVLZ29OuMp1ajc0jfM7gdY Hq5rmDUmBX+VOJLfGVzFlEa3cyECc1uJfNk3Ymlsx1H1rpfJpSoaM/qQNttWEUM+AVvd CNVQ== X-Gm-Message-State: AAQBX9f/gIJnEEoNgtogJ6rBq9R39ikoLv+YP6n32yys/67x4cqeOuAq 53NjsrZbcuaeX+YpStABHdrWAMMzJ14= X-Google-Smtp-Source: AKy350aVNz9pDZknqC6aKX0yug8v7CCd9OoAsTJvZ+U1d3MfgoczVArUB7Yc/3+b7tWanqa/YwyZfw== X-Received: by 2002:a05:6830:22c6:b0:68b:cdc3:78d7 with SMTP id q6-20020a05683022c600b0068bcdc378d7mr2333145otc.8.1681474745489; Fri, 14 Apr 2023 05:19:05 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id b6-20020a9d7546000000b006a2ce5f3641sm1643279otl.8.2023.04.14.05.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:04 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 14/18] version-gen: refactor main functionality Date: Fri, 14 Apr 2023 06:18:37 -0600 Message-Id: <20230414121841.373980-15-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It's pretty clear that the `version` file overrides `describe`, so do it in one function. There's no need for the comment as the code is self-describing. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index fa0e72a32c..53b3d64131 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -3,18 +3,12 @@ GVF=GIT-VERSION-FILE DEF_VER=2.40.GIT -describe () { +get_version () { + test -f version && cat version && return git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//' } -# First see if there is a version file (included in release tarballs), -# then try `git describe`, then default. -if test -f version -then - VN=$(cat version) -else - VN=$(describe) -fi +VN=$(get_version) : "${VN:=$DEF_VER}" From patchwork Fri Apr 14 12:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B6CC77B6E for ; Fri, 14 Apr 2023 12:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbjDNMTu (ORCPT ); Fri, 14 Apr 2023 08:19:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbjDNMTU (ORCPT ); Fri, 14 Apr 2023 08:19:20 -0400 Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68A77B741 for ; Fri, 14 Apr 2023 05:19:08 -0700 (PDT) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-187a742a963so2794335fac.10 for ; Fri, 14 Apr 2023 05:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474747; x=1684066747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JIGvxajfvtryih2lmcsbBElF96yKV22yxCa6ixUKZpo=; b=K/o5KfyoCyzWrC/QcTBrKnSXWYBr69RPxmQXNsTEPG4W+GSnWcQZfB9ykJzMc7hQx4 XQzRuw31T0c1R0DIvEhQtM+7WmRRna/CtF6clKj/Ub8eFOfZ6Pkb3gWYiMn3BTvrPwa2 F0+DmQuX8RcTgTzdQE8o1GkLRrOwEzxUJurfl/eMfN9DzTQ5k7v/zQkjsHwSJD1ZnI8l bbgnTrawp5E3fVSklOKnrHFH9n5ICErsYgs2+ucwyCM4OP/KNXBCFasdedaEn3GQwdfT 94U7lGvCbETVqgt0mEztjihUXR5ksBc0N2tGz43YEKzPtysgKMqc66sJvkSIlmGil0Qg AozA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474747; x=1684066747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JIGvxajfvtryih2lmcsbBElF96yKV22yxCa6ixUKZpo=; b=VhZt7bWYPlI1WS/krb171nEThdSICprScUskL7diWWGr3umWNM8KxS3kCoqciTZ+qU o8V1fc8xeOf8AbANvywWW8qxXUkj8+ccx/zUMts99f0HtjgCkaGdn0nAyEoSZ5Gc4n7r IADNyjDZHKegBO/5s+6hMeoKjCeDKNhU4AGuhIc0xVM5s/69rNkPNSi48GQVKDnLRNV/ zYeDV7OBAVTbrsowKsl2tM52Tm79TRCIOa/IouZ8Am+8NMUdDkGDzEn9USKDvDp/ozz8 9o5BxvTY88fACV6HqkoCsLamhcyaNrmYU/XDuSaFy3s5a7ZKi/nvM0vlaNY89/9twPw7 le0A== X-Gm-Message-State: AAQBX9dBR8+AeGfOZnyrBFM3EiW9cW88vLEHy1SzdtShqmki4TroOwHz O9tm17SKAW2QMe44JK/Ws9YHK5ZVOn0= X-Google-Smtp-Source: AKy350YzlCYCKcwCHFyFSRf5i5tcCM5LZCCQhi4R2xnJ7qdjmxENsOz8Emktr8QUp8q89CriOmIwOQ== X-Received: by 2002:a05:6870:611e:b0:187:afc1:ccc7 with SMTP id s30-20020a056870611e00b00187afc1ccc7mr984776oae.3.1681474747516; Fri, 14 Apr 2023 05:19:07 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id g3-20020a056870e1c300b0017e7052ed84sm1693325oab.41.2023.04.14.05.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:06 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 15/18] version-gen: remove default version Date: Fri, 14 Apr 2023 06:18:38 -0600 Message-Id: <20230414121841.373980-16-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There's two use-cases: 1) We are in a git repository 2) We are in a dir extracted from a tarball Is there any other case? Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 3 --- 1 file changed, 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 53b3d64131..2b0973f4b5 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,6 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=2.40.GIT get_version () { test -f version && cat version && return @@ -10,7 +9,5 @@ get_version () { VN=$(get_version) -: "${VN:=$DEF_VER}" - test -r $GVF && test "GIT_VERSION = $VN" = "$(cat $GVF)" && exit echo "GIT_VERSION = $VN" | tee $GVF >&2 From patchwork Fri Apr 14 12:18:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B210C77B78 for ; Fri, 14 Apr 2023 12:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjDNMTz (ORCPT ); Fri, 14 Apr 2023 08:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjDNMTV (ORCPT ); Fri, 14 Apr 2023 08:19:21 -0400 Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5240EB47B for ; Fri, 14 Apr 2023 05:19:10 -0700 (PDT) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-187878a90e6so7696319fac.0 for ; Fri, 14 Apr 2023 05:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474749; x=1684066749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4HU0YFHDcYBZPx41JKBqc4qnKClKqOBzYP3RJug22/8=; b=h/xLUjrhcu/r2vg0hTcCs4muv2oo8WzSesf0zYDun2rTvZbREHCeuCKt5+dePo/Hlw BMbytf8pWE7Uaba0pdJODRcDNnCTQkwjn+eBza3SMTs/pvbe2Bw9Ow6d9sZWibvHvBUh b9JyP/2I0Xb0bH1yN1rNCwRGFqRiDIdxSCiW+osuWkwp1sFfPb98Zst6kC8CN/e7aFqP 3j1V6zu+8h7pgE70/eeT0UXWcDguPGjNjkgjFlLCcCBzPvncjl39bEjA1KGJ9eBvqJdg bMaKZ3vrPdr9M+B77rDY1arnTe3CPrsm2JJ8ArqalkVAdxHVHG3TAjea6NZ/zusPubL4 jB6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474749; x=1684066749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4HU0YFHDcYBZPx41JKBqc4qnKClKqOBzYP3RJug22/8=; b=T9Gj1YF5FsW/dAbvckeyUirWuzA+u0y5bohHE6ldJlIcS13QdwUlgpo6PQQ8dvMtTX 9CFii9W4OKrQntJzh5VEQQuFcDr9tSg+dYrWqULmy5q7gGcrctqCBhfSTUuMP2M0HU9k MJJnwXWMz4S2+86GzSjVPSSht5rUT2dUd69jiDWE0ejP5T3kZ/Xbb0HBPMjNd5yMG6aR KKHM+QpQ9VvYDukM0C9mIB+Z4BM+JpW05vO+4FQjB8kSDAccdfBrBGxpygLC9uiBPnVf QSXM8uXCt5MZYGSb3JNh38NIW4wRIjAmASu16g+qpJrGOrEQ+68z0m5YF1Poj+C9o4L4 n8Xg== X-Gm-Message-State: AAQBX9eIObXpks4j0ieKmkdPB0j5MkKDgI5tWjB+iRNQ4wnoJRBZ1IeL P+ViRVDmGzTl/tltSvGt/jrqramarLg= X-Google-Smtp-Source: AKy350aUJ8pECSHsdoPADGtHqW3FMJmpB7Gx+InNYJu44+u43wd8S4+ZxAWmOTtR5SBLvJLcE+1TRw== X-Received: by 2002:a05:6870:c58f:b0:180:94ca:f44e with SMTP id ba15-20020a056870c58f00b0018094caf44emr3470047oab.25.1681474749301; Fri, 14 Apr 2023 05:19:09 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id zf24-20020a0568716a9800b0017ae6741157sm1734937oab.4.2023.04.14.05.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:08 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 16/18] version-gen: refactor GIT_VERSION string Date: Fri, 14 Apr 2023 06:18:39 -0600 Message-Id: <20230414121841.373980-17-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 2b0973f4b5..8f2250bb1b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -7,7 +7,7 @@ get_version () { git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//' } -VN=$(get_version) +NEW="GIT_VERSION = $(get_version)" -test -r $GVF && test "GIT_VERSION = $VN" = "$(cat $GVF)" && exit -echo "GIT_VERSION = $VN" | tee $GVF >&2 +test -r $GVF && test "$NEW" = "$(cat $GVF)" && exit +echo "$NEW" | tee $GVF >&2 From patchwork Fri Apr 14 12:18:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA02AC77B77 for ; Fri, 14 Apr 2023 12:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229911AbjDNMTx (ORCPT ); Fri, 14 Apr 2023 08:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230504AbjDNMTV (ORCPT ); Fri, 14 Apr 2023 08:19:21 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DA64B767 for ; Fri, 14 Apr 2023 05:19:11 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-187878a90e6so7696384fac.0 for ; Fri, 14 Apr 2023 05:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474750; x=1684066750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nH+efnO59F69GecAfIBijjIg7HeqCeBMZ/U56GD+3oQ=; b=GcFOz2vCz5GZKy9ibn+EAKv0+FkcUzvjAZjiqNf71n9gz8UKycxIjYrdIuH0QvGyke Q/vFeg7C0gVLf58ip7iPX8Z47F10NCmEssFRJ3WGaMVNchxUNa3UCbsWMYtehgezBMKQ C6MmpkQyx4PxbZdWr1PmpJ8m4X0H6hoEcgC8xMaDXH35hHBlybAw/PjkNR7UIMZI0Img CagSaBJfKmYEsKSd22H1tXi4TARTnslA2PzMeLf5cgzqC/ZCL1f9Z5tU9V8KcPLQEQPc TZWC7e6mtt5QdzNU/ERGkpDwVjbvvVcvA6SmCLTVDcCe40kwFK25z9j+IIgdAmzoiP4K hsFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474750; x=1684066750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nH+efnO59F69GecAfIBijjIg7HeqCeBMZ/U56GD+3oQ=; b=MfhfhwRA8+1tKELkZcRdrmtp8xjQbcjVJ23BcfMYaQwAgXgds00K8z6tGDhY6/VuJs j1U7l3nm2lkg8+SCOKSHpmENihnarN6H8inXGCR2YVFwovNDVvGP0xzH+h45GduzUM5f z1JzOLN2CCi6Lh8QQhmZW5BmhmdGEmvIOwy1u4XHp94E7leQUzBrNBKrfRMeOrHeLhwy /VLDw1ONApTf67waatjDWkOk28AtNHTKxOzXEFvmGp2ye2TuVmu4j5ifCaQ5TiLaEhl9 zVJd6TPSxRIE8x6qPY/H8aoRFkAxiT3MoK+eXXKlWZPhwOT7uSUK7xFeFue4I6iKjl4M 1+WA== X-Gm-Message-State: AAQBX9d8gTZfUEGKfYCCCRvziP2pHKEMiRqnVKPPSt+LC3IGwvyv8rp/ ZSwFsUMvwK+SXOHtjUIc07eMBhkXi8g= X-Google-Smtp-Source: AKy350bkNsSxNy2L6xPsqgEmftryqOF2rplXkAetMDlbwssD2UaeBIVgp2tjky3hOlxoVvT3neHDmw== X-Received: by 2002:a05:6870:831b:b0:177:8c47:c6bc with SMTP id p27-20020a056870831b00b001778c47c6bcmr3434646oae.50.1681474750693; Fri, 14 Apr 2023 05:19:10 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id bf27-20020a0568700a1b00b0017703b8a5f8sm1676755oac.49.2023.04.14.05.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:10 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 17/18] version-gen: get rid of GVF variable Date: Fri, 14 Apr 2023 06:18:40 -0600 Message-Id: <20230414121841.373980-18-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There's not much point in a variable which is never going to change and doesn't really add any readability. Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 8f2250bb1b..161fcdf1ab 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,5 @@ #!/bin/sh -GVF=GIT-VERSION-FILE - get_version () { test -f version && cat version && return git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//' @@ -9,5 +7,5 @@ get_version () { NEW="GIT_VERSION = $(get_version)" -test -r $GVF && test "$NEW" = "$(cat $GVF)" && exit -echo "$NEW" | tee $GVF >&2 +test -r GIT-VERSION-FILE && test "$NEW" = "$(cat GIT-VERSION-FILE)" && exit +echo "$NEW" | tee GIT-VERSION-FILE >&2 From patchwork Fri Apr 14 12:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 13211413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 414CBC77B7A for ; Fri, 14 Apr 2023 12:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbjDNMT5 (ORCPT ); Fri, 14 Apr 2023 08:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231133AbjDNMTW (ORCPT ); Fri, 14 Apr 2023 08:19:22 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 800D9B47F for ; Fri, 14 Apr 2023 05:19:13 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id ec6so5163430oib.8 for ; Fri, 14 Apr 2023 05:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681474752; x=1684066752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ec1J/m5HWnjTuS8Ur8RdtE/9QOvbxJc45gQAchmgOws=; b=bM5fPHAnvrAdJoeakPN3A7bLYJl6Aad8g8U8nxhT4EjtbP/cTrRyrhXfI1+SmlzNQT pGI2eZX3z598Oa373OzuzBDx7hKpaa+KZDmq15+CH1zvHLzckt/CZfOwztkSDNX1xfqt zhkIPOmOWUMZTyMYIxofVExNCyaDcJmQSq+yEuUJ+LEjYJ33+0QZ+BEfuMWsg+6DqlCc 3oEc6ZVaHJJejKf49DQ/gdq9wvXgzl+PB7lZKcC+bnnRb/TBGBa3qE9nAhLt88ldbvR3 qa1A/8v1p7lChl3gP3udsySI46X+C5dJ/XYpwP9/g+CZE8mUfVqT4JR89kGg1E1oIjX3 LlzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474752; x=1684066752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ec1J/m5HWnjTuS8Ur8RdtE/9QOvbxJc45gQAchmgOws=; b=evpsyLPHeQltZSXHs8zJGIPuY8xXn10+9kij6kx9ckiMG0s7Rel6HYzUWVPyOiN+eB 9bhp360NfBkeUqw1MXpWPuNZ9NRgJwQJDFGV5YYrfk6ieEAVnU7mCxttinIUdx+Vqk9k 7KR7KQbSMigccLTh4mQT+tAyNU9rGXkIOEbwhBWKQaqBI1HZGWE0enZzEA7SANOXKWi0 VxUiFDHzHApVDXXXxZ0WseuOGCqGAccGQbECCMjDN7TxtDGhAldvwrkUqDp2GIPu0xEs gkaIdSJay9bnMX0U8t22yr5H1DUpWMrwv+kHbDEYpSfFlrdxjsqRSv1Ca5LBXg1Nex4d p67w== X-Gm-Message-State: AAQBX9c66iD98ze/fceyFK3TNdnRFoFthK2dPWKH7E5ZylIAjaLlwv6v Vcgh2VMcqSyRp0k1RdhSLrP6sSGv8QU= X-Google-Smtp-Source: AKy350Zul7emKiF0AHQxvvILV7QNybW+NprWnNYuwq1gEdwerUKEwjcwymCtC8hfNh0JLAKPpdN41g== X-Received: by 2002:a05:6808:a92:b0:383:f8a3:2529 with SMTP id q18-20020a0568080a9200b00383f8a32529mr2389273oij.6.1681474752093; Fri, 14 Apr 2023 05:19:12 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id z8-20020aca3308000000b0038c34e67d47sm834938oiz.55.2023.04.14.05.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:19:11 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Jeff King , Junio C Hamano , Felipe Contreras Subject: [PATCH 18/18] version-gen: generate proper interim versions Date: Fri, 14 Apr 2023 06:18:41 -0600 Message-Id: <20230414121841.373980-19-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.40.0+fc1 In-Reply-To: <20230414121841.373980-1-felipe.contreras@gmail.com> References: <20230414121841.373980-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The change from dashes to dots was done in 2006 to satisfy some RPM requirements: 5c7d3c9507 (Allow building of RPM from interim snapshot., 2006-01-16). This probably was done because `2.40.0-100-g000` would be interpreted as version `2.40.0` release `100`. It isn't clear because the commit message doesn't explain. But using a dot makes it worse because `2.40.0.n` will always be newer than `2.40.0-n`. What we want is an ordering such as: * 2.40.0 # git release * 2.40.0+100-g00 # interim version * 2.40.0-1 # Fedora release * 2.40.0.1 # hypothetical git release So we should use a single `+` sign for interim versions, and for the record that's what Mercurial does `6.3.3+hg591.dd42156b6441`. [1] https://rpm-software-management.github.io/rpm/manual/dependencies.html Cc: Junio C Hamano Signed-off-by: Felipe Contreras --- GIT-VERSION-GEN | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 161fcdf1ab..99584bf86d 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -2,7 +2,7 @@ get_version () { test -f version && cat version && return - git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' -e 's/^v//' + git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/+/' -e 's/^v//' } NEW="GIT_VERSION = $(get_version)"