diff mbox series

t0091: allow test in a repository without tags

Message ID xmqqv87aabk3.fsf@gitster.g (mailing list archive)
State Accepted
Commit 3cb4384683ea128e6720b961e41aaf82c45cf1fe
Headers show
Series t0091: allow test in a repository without tags | expand

Commit Message

Junio C Hamano Jan. 30, 2024, 7:03 p.m. UTC
The beginning of the [System Info] section, which should match the
"git version --build-options" output, may not identify our version
as "git version 2.whatever".  When build in a repository cloned
without tags, for example, "git version unknown.g00000000" can be a
legit version string.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t0091-bugreport.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Sunshine Jan. 30, 2024, 8:53 p.m. UTC | #1
On Tue, Jan 30, 2024 at 2:03 PM Junio C Hamano <gitster@pobox.com> wrote:
> The beginning of the [System Info] section, which should match the
> "git version --build-options" output, may not identify our version
> as "git version 2.whatever".  When build in a repository cloned

s/build/built/

> without tags, for example, "git version unknown.g00000000" can be a
> legit version string.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano Jan. 30, 2024, 9:46 p.m. UTC | #2
Eric Sunshine <sunshine@sunshineco.com> writes:

> On Tue, Jan 30, 2024 at 2:03 PM Junio C Hamano <gitster@pobox.com> wrote:
>> The beginning of the [System Info] section, which should match the
>> "git version --build-options" output, may not identify our version
>> as "git version 2.whatever".  When build in a repository cloned
>
> s/build/built/

Thanks.
Martin Ågren Feb. 5, 2024, 10:07 a.m. UTC | #3
On Tue, 30 Jan 2024 at 20:03, Junio C Hamano <gitster@pobox.com> wrote:
>
> The beginning of the [System Info] section, which should match the
> "git version --build-options" output, may not identify our version
> as "git version 2.whatever".  When build in a repository cloned
> without tags, for example, "git version unknown.g00000000" can be a
> legit version string.

I've tried reproducing this along the lines of

  git clone --no-tags <url>
  cd git
  make
  (cd t && ./t0091-*)

but this works for me on current master, 2a540e432f ("The thirteenth
batch", 2024-02-02), which doesn't have this patch.

GIT-VERSION-GEN seems to be careful to only use tags on the wanted form.
My build generates a git version of "2.43.GIT", no "unknown..." stuff.

I don't doubt that you've hit this, I just wonder which piece of the
puzzle I'm missing.

> -       # The beginning should match "git version --build-info" verbatim,
> +       # The beginning should match "git version --build-options" verbatim,

Correct, my thinko-typo, thanks for correcting.

>         # but rather than checking bit-for-bit equality, just test some basics.
> -       grep "git version [0-9]." system &&
> +       grep "git version " system &&

This matches the commit message, ok.

Martin
Junio C Hamano Feb. 6, 2024, 6:33 p.m. UTC | #4
Martin Ågren <martin.agren@gmail.com> writes:

> GIT-VERSION-GEN seems to be careful to only use tags on the wanted form.
> My build generates a git version of "2.43.GIT", no "unknown..." stuff.
>
> I don't doubt that you've hit this, I just wonder which piece of the
> puzzle I'm missing.

I wonder that too.

I was experimenting with "seen" with the reftable.  I first created
a new and empty repository with "git init --ref-format=reftable" in
a brand new directory next to my primary working area, and then did
"git fetch --no-tags ../git.git/ master" or something to pull the
history without tags in.  After that I thought I was careful to make
sure I only ran the "seen" version of Git (all my other installations
of Git are unaware of reftable, and the version of Git on my regular
$PATH is not from the "seen" branch), but perhaps I screwed up at
some point and the mistake got stuck in the version file, or something
silly like that, perhaps.

>
>> -       # The beginning should match "git version --build-info" verbatim,
>> +       # The beginning should match "git version --build-options" verbatim,
>
> Correct, my thinko-typo, thanks for correcting.
>
>>         # but rather than checking bit-for-bit equality, just test some basics.
>> -       grep "git version [0-9]." system &&
>> +       grep "git version " system &&
>
> This matches the commit message, ok.
>
> Martin
diff mbox series

Patch

diff --git c/t/t0091-bugreport.sh w/t/t0091-bugreport.sh
index 8798feefe3..fca39048fe 100755
--- c/t/t0091-bugreport.sh
+++ w/t/t0091-bugreport.sh
@@ -39,9 +39,9 @@  test_expect_success 'sanity check "System Info" section' '
 
 	sed -ne "/^\[System Info\]$/,/^$/p" <git-bugreport-format.txt >system &&
 
-	# The beginning should match "git version --build-info" verbatim,
+	# The beginning should match "git version --build-options" verbatim,
 	# but rather than checking bit-for-bit equality, just test some basics.
-	grep "git version [0-9]." system &&
+	grep "git version " system &&
 	grep "shell-path: ." system &&
 
 	# After the version, there should be some more info.