Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	Todd Zullinger <tmz@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v2 06/15] version-gen: simplify `git describe` checks
Date: Mon, 24 Apr 2023 10:50:32 -0600	[thread overview]
Message-ID: <20230424165041.25180-7-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20230424165041.25180-1-felipe.contreras@gmail.com>

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 <felipe.contreras@gmail.com>
---
 GIT-VERSION-GEN | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 34f561752b..e99c7b45c0 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),
-- 
2.40.0+fc1


  parent reply	other threads:[~2023-04-24 16:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 16:50 [PATCH v2 00/15] version-gen: complete revamp/rewrite Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 01/15] version-gen: reorganize Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 02/15] version-gen: trivial cleanup Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 03/15] version-gen: refactor default version Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 04/15] version-gen: simplify v prefix removal Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 05/15] version-gen: simplify update check Felipe Contreras
2023-04-24 16:50 ` Felipe Contreras [this message]
2023-04-24 16:50 ` [PATCH v2 07/15] version-gen: simplify dirty check Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 08/15] version-gen: move describe fix into function Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 09/15] version-gen: describe and sed in one go Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 10/15] version-gen: refactor describe function Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 11/15] version-gen: do v fix only when necessary Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 12/15] version-gen: move v fix into sed Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 13/15] version-gen: refactor main functionality Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 14/15] version-gen: refactor GIT_VERSION string Felipe Contreras
2023-04-24 16:50 ` [PATCH v2 15/15] version-gen: get rid of GVF variable Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230424165041.25180-7-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).