git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/18] version-gen: complete revamp/rewrite
@ 2023-04-14 12:18 Felipe Contreras
  2023-04-14 12:18 ` [PATCH 01/18] version-gen: reorganize Felipe Contreras
                   ` (17 more replies)
  0 siblings, 18 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

The version generation script needs some love, as the last true change was done in 2008.

This series step by step revamps the whole script ending in only a few lines of code:

    get_version () {
        test -f version && cat version && return
        git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/+/' -e 's/^v//'
    }

    NEW="GIT_VERSION = $(get_version)"

    test -r GIT-VERSION-FILE && test "$NEW" = "$(cat GIT-VERSION-FILE)" && exit
    echo "$NEW" | tee GIT-VERSION-FILE >&2

There should be no functional changes except for the last patch that changes
interim version from `2.40.0.$n.g${oid}` to `2.40.0+$n-g${oid}` as that causes
the proper sorting.

It's hard to see the actual changes to this script as 99% of the commits are
just to bump the default version (which I don't know why it even exists).

For reference, cleaning the history I came up with these actual changes in case
anyone is interested:

c48799e560 (Teach GIT-VERSION-GEN about the .git file, 2008-02-20)
1100ac81a9 (Change GIT-VERSION-GEN to call git commands with "git" not "git-"., 2006-05-22)
374dfaa2e3 (Make GIT-VERSION-GEN tolerate missing git describe command again, 2006-01-26)
5c7d3c9507 (Allow building of RPM from interim snapshot., 2006-01-16)
181129d24c (For release tarballs, include the proper version, 2006-01-09)
026351a035 (Make GIT-VERSION-GEN tolerate missing git describe command, 2005-12-30)
9b88fcef7d (Makefile: use git-describe to mark the git version., 2005-12-27)

Cheers.

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 9a1111af9b..99584bf86d 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,40 +1,11 @@
 #!/bin/sh
 
-GVF=GIT-VERSION-FILE
-DEF_VER=v2.40.GIT
-
-LF='
-'
-
-# 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
-then
-	VN=$(echo "$VN" | sed -e 's/-/./g');
-else
-	VN="$DEF_VER"
-fi
-
-VN=$(expr "$VN" : v*'\(.*\)')
-
-if test -r $GVF
-then
-	VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
-	VC=unset
-fi
-test "$VN" = "$VC" || {
-	echo >&2 "GIT_VERSION = $VN"
-	echo "GIT_VERSION = $VN" >$GVF
+get_version () {
+	test -f version && cat version && return
+	git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/+/' -e 's/^v//'
 }
+
+NEW="GIT_VERSION = $(get_version)"
+
+test -r GIT-VERSION-FILE && test "$NEW" = "$(cat GIT-VERSION-FILE)" && exit
+echo "$NEW" | tee GIT-VERSION-FILE >&2

Felipe Contreras (18):
  version-gen: reorganize
  version-gen: trivial cleanup
  version-gen: refactor default version
  version-gen: simplify v prefix removal
  version-gen: simplify update check
  version-gen: remove redundant check
  version-gen: simplify `git describe` checks
  version-gen: simplify dirty check
  version-gen: move describe fix into function
  version-gen: describe and sed in one go
  version-gen: refactor describe function
  version-gen: do v fix only when necessary
  version-gen: move v fix into sed
  version-gen: refactor main functionality
  version-gen: remove default version
  version-gen: refactor GIT_VERSION string
  version-gen: get rid of GVF variable
  version-gen: generate proper interim versions

 GIT-VERSION-GEN | 45 ++++++++-------------------------------------
 1 file changed, 8 insertions(+), 37 deletions(-)

-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 01/18] version-gen: reorganize
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 02/18] version-gen: trivial cleanup Felipe Contreras
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/18] version-gen: trivial cleanup
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
  2023-04-14 12:18 ` [PATCH 01/18] version-gen: reorganize Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 03/18] version-gen: refactor default version Felipe Contreras
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/18] version-gen: refactor default version
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
  2023-04-14 12:18 ` [PATCH 01/18] version-gen: reorganize Felipe Contreras
  2023-04-14 12:18 ` [PATCH 02/18] version-gen: trivial cleanup Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 04/18] version-gen: simplify v prefix removal Felipe Contreras
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/18] version-gen: simplify v prefix removal
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (2 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 03/18] version-gen: refactor default version Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 05/18] version-gen: simplify update check Felipe Contreras
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

There is a much simpler way.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/18] version-gen: simplify update check
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (3 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 04/18] version-gen: simplify v prefix removal Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 06/18] version-gen: remove redundant check Felipe Contreras
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

We don't need to extract the version when we can compare the whole
contents.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (4 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 05/18] version-gen: simplify update check Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 15:11   ` Todd Zullinger
  2023-04-14 12:18 ` [PATCH 07/18] version-gen: simplify `git describe` checks Felipe Contreras
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

If we are not in a git repository `git describe` will fail anyway.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/18] version-gen: simplify `git describe` checks
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (5 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 06/18] version-gen: remove redundant check Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 08/18] version-gen: simplify dirty check Felipe Contreras
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 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),
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/18] version-gen: simplify dirty check
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (6 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 07/18] version-gen: simplify `git describe` checks Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 09/18] version-gen: move describe fix into function Felipe Contreras
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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),
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/18] version-gen: move describe fix into function
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (7 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 08/18] version-gen: simplify dirty check Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 10/18] version-gen: describe and sed in one go Felipe Contreras
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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}"
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/18] version-gen: describe and sed in one go
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (8 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 09/18] version-gen: move describe fix into function Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 11/18] version-gen: refactor describe function Felipe Contreras
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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),
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 11/18] version-gen: refactor describe function
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (9 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 10/18] version-gen: describe and sed in one go Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 12/18] version-gen: do v fix only when necessary Felipe Contreras
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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}"
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 12/18] version-gen: do v fix only when necessary
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (10 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 11/18] version-gen: refactor describe function Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 13/18] version-gen: move v fix into sed Felipe Contreras
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 13/18] version-gen: move v fix into sed
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (11 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 12/18] version-gen: do v fix only when necessary Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 14/18] version-gen: refactor main functionality Felipe Contreras
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

We are already using sed, might as well take advantage of it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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}"
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 14/18] version-gen: refactor main functionality
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (12 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 13/18] version-gen: move v fix into sed Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 15/18] version-gen: remove default version Felipe Contreras
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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}"
 
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 15/18] version-gen: remove default version
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (13 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 14/18] version-gen: refactor main functionality Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 16/18] version-gen: refactor GIT_VERSION string Felipe Contreras
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 16/18] version-gen: refactor GIT_VERSION string
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (14 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 15/18] version-gen: remove default version Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 17/18] version-gen: get rid of GVF variable Felipe Contreras
  2023-04-14 12:18 ` [PATCH 18/18] version-gen: generate proper interim versions Felipe Contreras
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 17/18] version-gen: get rid of GVF variable
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (15 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 16/18] version-gen: refactor GIT_VERSION string Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  2023-04-14 12:18 ` [PATCH 18/18] version-gen: generate proper interim versions Felipe Contreras
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <felipe.contreras@gmail.com>
---
 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
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 18/18] version-gen: generate proper interim versions
  2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
                   ` (16 preceding siblings ...)
  2023-04-14 12:18 ` [PATCH 17/18] version-gen: get rid of GVF variable Felipe Contreras
@ 2023-04-14 12:18 ` Felipe Contreras
  17 siblings, 0 replies; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 12:18 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano, Felipe Contreras

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 <gitster@pobox.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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)"
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 12:18 ` [PATCH 06/18] version-gen: remove redundant check Felipe Contreras
@ 2023-04-14 15:11   ` Todd Zullinger
  2023-04-14 17:47     ` Felipe Contreras
  0 siblings, 1 reply; 24+ messages in thread
From: Todd Zullinger @ 2023-04-14 15:11 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git, Jeff King, Junio C Hamano

Felipe Contreras wrote:
> If we are not in a git repository `git describe` will fail anyway.

The parent directory may be a git repository though.  The
current code ensures that we're running `git describe` in
the proper repository.

If we drop this, aren't we breaking things for someone
building a git tarball which is in a subdirectory of a git
repository?

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  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

-- 
Todd

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 15:11   ` Todd Zullinger
@ 2023-04-14 17:47     ` Felipe Contreras
  2023-04-14 19:01       ` Todd Zullinger
  0 siblings, 1 reply; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 17:47 UTC (permalink / raw)
  To: Todd Zullinger, Felipe Contreras; +Cc: git, Jeff King, Junio C Hamano

Todd Zullinger wrote:
> Felipe Contreras wrote:
> > If we are not in a git repository `git describe` will fail anyway.
> 
> The parent directory may be a git repository though.  The
> current code ensures that we're running `git describe` in
> the proper repository.

How exactly does it do that?

The current code expects the cwd to be the git repo, run it in any other
directory and it will generate GIT-VERSION-FILE in that directory, which is
clearly not intended.

> If we drop this, aren't we breaking things for someone
> building a git tarball which is in a subdirectory of a git
> repository?

How exactly would this hypothetical person build such a tarball?

  git init /tmp/foo
  mkdir -p /tmp/foo/bar
  cd /tmp/foo/bar
  make -C ~/dev/git dist

Works fine.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 17:47     ` Felipe Contreras
@ 2023-04-14 19:01       ` Todd Zullinger
  2023-04-14 19:32         ` Felipe Contreras
  0 siblings, 1 reply; 24+ messages in thread
From: Todd Zullinger @ 2023-04-14 19:01 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git, Jeff King, Junio C Hamano

Felipe Contreras wrote:
> Todd Zullinger wrote:
>> Felipe Contreras wrote:
>>> If we are not in a git repository `git describe` will fail anyway.
>> 
>> The parent directory may be a git repository though.  The
>> current code ensures that we're running `git describe` in
>> the proper repository.
> 
> How exactly does it do that?
> 
> The current code expects the cwd to be the git repo, run it in any other
> directory and it will generate GIT-VERSION-FILE in that directory, which is
> clearly not intended.

Whether it's fool proof isn't really my point.  It did
attempt to check that .git was a file or directory.  Not
checking at all isn't necessarily an improvement, was my
concern.

>> If we drop this, aren't we breaking things for someone
>> building a git tarball which is in a subdirectory of a git
>> repository?
> 
> How exactly would this hypothetical person build such a tarball?
> 
>   git init /tmp/foo
>   mkdir -p /tmp/foo/bar
>   cd /tmp/foo/bar
>   make -C ~/dev/git dist

If I have a git repo, say ~/fedora/git which contains the
fedora packaging (spec file, etc.) and extract a git archive
in this directory, the describe will now pick up the data
from the parent git directory, won't it?

    $ git -C ~/fedora clone https://src.fedoraproject.org/rpms/git.git
    $ cd ~/fedora/git
    $ git -C ~/upstream/git archive --format=tar --prefix=git/ HEAD | tar xf -
    $ cd git
    $ make GIT-VERSION-GEN
    $ cat GIT-VERSION-FILE 
    GIT_VERSION = 

The version file in the tarballs prevents this from
happening in the most common case, but it still feels like
this is loosening things a little more than it should.

-- 
Todd

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 19:01       ` Todd Zullinger
@ 2023-04-14 19:32         ` Felipe Contreras
  2023-04-14 19:41           ` Todd Zullinger
  0 siblings, 1 reply; 24+ messages in thread
From: Felipe Contreras @ 2023-04-14 19:32 UTC (permalink / raw)
  To: Todd Zullinger, Felipe Contreras; +Cc: git, Jeff King, Junio C Hamano

Todd Zullinger wrote:
> Felipe Contreras wrote:
> > Todd Zullinger wrote:
> >> Felipe Contreras wrote:
> >>> If we are not in a git repository `git describe` will fail anyway.
> >> 
> >> The parent directory may be a git repository though.  The
> >> current code ensures that we're running `git describe` in
> >> the proper repository.
> > 
> > How exactly does it do that?
> > 
> > The current code expects the cwd to be the git repo, run it in any other
> > directory and it will generate GIT-VERSION-FILE in that directory, which is
> > clearly not intended.
> 
> Whether it's fool proof isn't really my point.  It did
> attempt to check that .git was a file or directory.  Not
> checking at all isn't necessarily an improvement, was my
> concern.
> 
> >> If we drop this, aren't we breaking things for someone
> >> building a git tarball which is in a subdirectory of a git
> >> repository?
> > 
> > How exactly would this hypothetical person build such a tarball?
> > 
> >   git init /tmp/foo
> >   mkdir -p /tmp/foo/bar
> >   cd /tmp/foo/bar
> >   make -C ~/dev/git dist
> 
> If I have a git repo, say ~/fedora/git which contains the
> fedora packaging (spec file, etc.) and extract a git archive
> in this directory, the describe will now pick up the data
> from the parent git directory, won't it?
> 
>     $ git -C ~/fedora clone https://src.fedoraproject.org/rpms/git.git
>     $ cd ~/fedora/git
>     $ git -C ~/upstream/git archive --format=tar --prefix=git/ HEAD | tar xf -
>     $ cd git
>     $ make GIT-VERSION-GEN
>     $ cat GIT-VERSION-FILE 
>     GIT_VERSION = 

I don't think this is a realistic use-case, but supposing it is, what would be
the desired outcome in this case?

 GIT_VERSION = 2.40.GIT

?

> The version file in the tarballs prevents this from
> happening in the most common case, but it still feels like
> this is loosening things a little more than it should.

If we care about this, the same behavior can be achieved with GIT_CEILING_DIRECTORIES:

 GIT_CEILING_DIRECTORIES=$(cd .. && pwd) git describe ...

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 06/18] version-gen: remove redundant check
  2023-04-14 19:32         ` Felipe Contreras
@ 2023-04-14 19:41           ` Todd Zullinger
  0 siblings, 0 replies; 24+ messages in thread
From: Todd Zullinger @ 2023-04-14 19:41 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git, Jeff King, Junio C Hamano

Felipe Contreras wrote:
> Todd Zullinger wrote:
>> If I have a git repo, say ~/fedora/git which contains the
>> fedora packaging (spec file, etc.) and extract a git archive
>> in this directory, the describe will now pick up the data
>> from the parent git directory, won't it?
>> 
>>     $ git -C ~/fedora clone https://src.fedoraproject.org/rpms/git.git
>>     $ cd ~/fedora/git
>>     $ git -C ~/upstream/git archive --format=tar --prefix=git/ HEAD | tar xf -
>>     $ cd git
>>     $ make GIT-VERSION-GEN
>>     $ cat GIT-VERSION-FILE 
>>     GIT_VERSION = 
> 
> I don't think this is a realistic use-case, but supposing it is, what would be
> the desired outcome in this case?
> 
>  GIT_VERSION = 2.40.GIT
> 
> ?

That's what we get before this change.  I don't have an
opinion on whether that could/should change, but if it does,
it should be deliberate I think.

>> The version file in the tarballs prevents this from
>> happening in the most common case, but it still feels like
>> this is loosening things a little more than it should.
> 
> If we care about this, the same behavior can be achieved with GIT_CEILING_DIRECTORIES:
> 
>  GIT_CEILING_DIRECTORIES=$(cd .. && pwd) git describe ...

I only mention it because it seemed like a change in
behavior when the series aimed to not change any behavior.
I'm sure there are plenty of things which could be changed
while making imrpveoments here.  I think we'll be better off
if those changes are all noted and deliberate.

Thanks for working on this stuff, it is good to see
improvements to this sort of plumbing.

-- 
Todd

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-04-14 19:42 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
2023-04-14 12:18 ` [PATCH 01/18] version-gen: reorganize Felipe Contreras
2023-04-14 12:18 ` [PATCH 02/18] version-gen: trivial cleanup Felipe Contreras
2023-04-14 12:18 ` [PATCH 03/18] version-gen: refactor default version Felipe Contreras
2023-04-14 12:18 ` [PATCH 04/18] version-gen: simplify v prefix removal Felipe Contreras
2023-04-14 12:18 ` [PATCH 05/18] version-gen: simplify update check Felipe Contreras
2023-04-14 12:18 ` [PATCH 06/18] version-gen: remove redundant check Felipe Contreras
2023-04-14 15:11   ` Todd Zullinger
2023-04-14 17:47     ` Felipe Contreras
2023-04-14 19:01       ` Todd Zullinger
2023-04-14 19:32         ` Felipe Contreras
2023-04-14 19:41           ` Todd Zullinger
2023-04-14 12:18 ` [PATCH 07/18] version-gen: simplify `git describe` checks Felipe Contreras
2023-04-14 12:18 ` [PATCH 08/18] version-gen: simplify dirty check Felipe Contreras
2023-04-14 12:18 ` [PATCH 09/18] version-gen: move describe fix into function Felipe Contreras
2023-04-14 12:18 ` [PATCH 10/18] version-gen: describe and sed in one go Felipe Contreras
2023-04-14 12:18 ` [PATCH 11/18] version-gen: refactor describe function Felipe Contreras
2023-04-14 12:18 ` [PATCH 12/18] version-gen: do v fix only when necessary Felipe Contreras
2023-04-14 12:18 ` [PATCH 13/18] version-gen: move v fix into sed Felipe Contreras
2023-04-14 12:18 ` [PATCH 14/18] version-gen: refactor main functionality Felipe Contreras
2023-04-14 12:18 ` [PATCH 15/18] version-gen: remove default version Felipe Contreras
2023-04-14 12:18 ` [PATCH 16/18] version-gen: refactor GIT_VERSION string Felipe Contreras
2023-04-14 12:18 ` [PATCH 17/18] version-gen: get rid of GVF variable Felipe Contreras
2023-04-14 12:18 ` [PATCH 18/18] version-gen: generate proper interim versions Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).