From owner-dev-commits-src-main@freebsd.org Wed Jan 20 09:49:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C4C44EFDA4; Wed, 20 Jan 2021 09:49:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLLND6bgyz4SK1; Wed, 20 Jan 2021 09:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D526917428; Wed, 20 Jan 2021 09:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K9nmLD029086; Wed, 20 Jan 2021 09:49:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K9nmkZ029085; Wed, 20 Jan 2021 09:49:48 GMT (envelope-from git) Date: Wed, 20 Jan 2021 09:49:48 GMT Message-Id: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ulrich Spörlein Subject: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: uqs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9fc14fbf445cffd18f34f6a602bdba84bb5a867 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 09:49:49 -0000 The branch main has been updated by uqs: URL: https://cgit.FreeBSD.org/src/commit/?id=a9fc14fbf445cffd18f34f6a602bdba84bb5a867 commit a9fc14fbf445cffd18f34f6a602bdba84bb5a867 Author: Michael Osipov AuthorDate: 2021-01-05 10:48:39 +0000 Commit: Ulrich Spörlein CommitDate: 2021-01-20 09:48:27 +0000 newvers.sh: add support for gitup(1) gitup writes a .gituprevision file into the shallow clone directory. Read that file and print commit information only. Submitted by: Michael Osipov Pull Request: https://github.com/freebsd/freebsd-src/pull/449 While here, drop the redundant branch name from the git output and don't count commits in shallow clones. Reported by: Michael Osipov MFC after: 2 weeks --- sys/conf/newvers.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 2a0ace45f2f6..92c275d19fb9 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -221,6 +221,10 @@ if findvcs .git; then done fi +if findvcs .gituprevision; then + gituprevision="${VCSTOP}/.gituprevision" +fi + if findvcs .hg; then for dir in /usr/bin /usr/local/bin; do if [ -x "${dir}/hg" ] ; then @@ -248,13 +252,11 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) - git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) - if [ -n "$git_cnt" ] ; then - git="c${git_cnt}-g${git}" - fi - git_b=$($git_cmd rev-parse --abbrev-ref HEAD) - if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then - git="${git_b}-${git}" + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then + git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) + if [ -n "$git_cnt" ] ; then + git="c${git_cnt}-g${git}" + fi fi if git_tree_modified; then git="${git}-dirty" @@ -263,6 +265,10 @@ if [ -n "$git_cmd" ] ; then git=" ${git}" fi +if [ -n "$gituprevision" ] ; then + gitup=" $(awk -F: '{print $2}' $gituprevision)" +fi + if [ -n "$hg_cmd" ] ; then hg=$($hg_cmd id 2>/dev/null) hgsvn=$($hg_cmd svn info 2>/dev/null | \ @@ -277,10 +283,10 @@ fi [ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes if [ ${include_metadata} != "yes" ]; then - VERINFO="${VERSION}${svn}${git}${hg} ${i}" + VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}" VERSTR="${VERINFO}\\n" else - VERINFO="${VERSION} #${v}${svn}${git}${hg}: ${t}" + VERINFO="${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}" VERSTR="${VERINFO}\\n ${u}@${h}:${d}\\n" fi