diff mbox series

[01/34] t0450: *.txt -> *.adoc fixes

Message ID 20250303204443.360595-2-tmz@pobox.com (mailing list archive)
State New
Headers show
Series misc *.txt -> *.adoc fixes | expand

Commit Message

Todd Zullinger March 3, 2025, 8:43 p.m. UTC
After 1f010d6bdf (doc: use .adoc extension for AsciiDoc files,
2025-01-20), we no longer matched any files in this test.  The result is
that we did not test for mismatches in the documentation and --help
output.

Adjust the test to look at the renamed *.adoc files.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
 t/t0450-txt-doc-vs-help.sh                    | 50 +++++++++----------
 ...t-help-mismatches => adoc-help-mismatches} |  0
 2 files changed, 25 insertions(+), 25 deletions(-)
 rename t/t0450/{txt-help-mismatches => adoc-help-mismatches} (100%)

Comments

Junio C Hamano March 3, 2025, 9:52 p.m. UTC | #1
Todd Zullinger <tmz@pobox.com> writes:

> After 1f010d6bdf (doc: use .adoc extension for AsciiDoc files,
> 2025-01-20), we no longer matched any files in this test.  The result is
> that we did not test for mismatches in the documentation and --help
> output.
>
> Adjust the test to look at the renamed *.adoc files.
>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
>  t/t0450-txt-doc-vs-help.sh                    | 50 +++++++++----------
>  ...t-help-mismatches => adoc-help-mismatches} |  0
>  2 files changed, 25 insertions(+), 25 deletions(-)
>  rename t/t0450/{txt-help-mismatches => adoc-help-mismatches} (100%)

Wow, good find.  This is especially bad and I am glad we caught it
before -rc1 (the hope was that all of these should have been caught
while the topic was in 'next', which was the whole point of cooking
it longer in 'next' than usual, but that plan did not really work).

> diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
> index 853101b86e..2f7504ae7e 100755
> --- a/t/t0450-txt-doc-vs-help.sh
> +++ b/t/t0450-txt-doc-vs-help.sh
> @@ -1,6 +1,6 @@
>  #!/bin/sh
>  
> -test_description='assert (unbuilt) Documentation/*.txt and -h output
> +test_description='assert (unbuilt) Documentation/*.adoc and -h output
>  
>  Run this with --debug to see a summary of where we still fail to make
>  the two versions consistent with one another.'
> @@ -11,11 +11,11 @@ test_expect_success 'setup: list of builtins' '
>  	git --list-cmds=builtins >builtins
>  '
>  
> -test_expect_success 'list of txt and help mismatches is sorted' '
> -	sort -u "$TEST_DIRECTORY"/t0450/txt-help-mismatches >expect &&
> -	if ! test_cmp expect "$TEST_DIRECTORY"/t0450/txt-help-mismatches
> +test_expect_success 'list of adoc and help mismatches is sorted' '
> +	sort -u "$TEST_DIRECTORY"/t0450/adoc-help-mismatches >expect &&
> +	if ! test_cmp expect "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
>  	then
> -		BUG "please keep the list of txt and help mismatches sorted"
> +		BUG "please keep the list of adoc and help mismatches sorted"
>  	fi
>  '
>  
> @@ -40,20 +40,20 @@ help_to_synopsis () {
>  	echo "$out"
>  }
>  
> -builtin_to_txt () {
> -       echo "$GIT_BUILD_DIR/Documentation/git-$1.txt"
> +builtin_to_adoc () {
> +       echo "$GIT_BUILD_DIR/Documentation/git-$1.adoc"
>  }
>  
> -txt_to_synopsis () {
> +adoc_to_synopsis () {
>  	builtin="$1" &&
>  	out_dir="out/$builtin" &&
> -	out="$out_dir/txt.synopsis" &&
> +	out="$out_dir/adoc.synopsis" &&
>  	if test -f "$out"
>  	then
>  		echo "$out" &&
>  		return 0
>  	fi &&
> -	b2t="$(builtin_to_txt "$builtin")" &&
> +	b2t="$(builtin_to_adoc "$builtin")" &&
>  	sed -n \
>  		-E '/^\[(verse|synopsis)\]$/,/^$/ {
>  			/^$/d;
> @@ -109,29 +109,29 @@ do
>  		fi
>  	'
>  
> -	txt="$(builtin_to_txt "$builtin")" &&
> -	preq="$(echo BUILTIN_TXT_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
> +	adoc="$(builtin_to_adoc "$builtin")" &&
> +	preq="$(echo BUILTIN_ADOC_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
>  
> -	if test -f "$txt"
> +	if test -f "$adoc"
>  	then
>  		test_set_prereq "$preq"
>  	fi &&
>  
> -	# *.txt output assertions
> -	test_expect_success "$preq" "$builtin *.txt SYNOPSIS has dashed labels" '
> -		check_dashed_labels "$(txt_to_synopsis "$builtin")"
> +	# *.adoc output assertions
> +	test_expect_success "$preq" "$builtin *.adoc SYNOPSIS has dashed labels" '
> +		check_dashed_labels "$(adoc_to_synopsis "$builtin")"
>  	'
>  
> -	# *.txt output consistency assertions
> +	# *.adoc output consistency assertions
>  	result=
> -	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/txt-help-mismatches
> +	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
>  	then
>  		result=failure
>  	else
>  		result=success
>  	fi &&
>  	test_expect_$result "$preq" "$builtin -h output and SYNOPSIS agree" '
> -		t2s="$(txt_to_synopsis "$builtin")" &&
> +		t2s="$(adoc_to_synopsis "$builtin")" &&
>  		if test "$builtin" = "merge-tree"
>  		then
>  			test_when_finished "rm -f t2s.new" &&
> @@ -140,17 +140,17 @@ do
>  		fi &&
>  		h2s="$(help_to_synopsis "$builtin")" &&
>  
> -		# The *.txt and -h use different spacing for the
> +		# The *.adoc and -h use different spacing for the
>  		# alignment of continued usage output, normalize it.
> -		align_after_nl "$builtin" <"$t2s" >txt &&
> +		align_after_nl "$builtin" <"$t2s" >adoc &&
>  		align_after_nl "$builtin" <"$h2s" >help &&
> -		test_cmp txt help
> +		test_cmp adoc help
>  	'
>  
> -	if test_have_prereq "$preq" && test -e txt && test -e help
> +	if test_have_prereq "$preq" && test -e adoc && test -e help
>  	then
>  		test_debug '
> -			if test_cmp txt help >cmp 2>/dev/null
> +			if test_cmp adoc help >cmp 2>/dev/null
>  			then
>  				echo "=== DONE: $builtin ==="
>  			else
> @@ -161,7 +161,7 @@ do
>  
>  		# Not in test_expect_success in case --run is being
>  		# used with --debug
> -		rm -f txt help tmp 2>/dev/null
> +		rm -f adoc help tmp 2>/dev/null
>  	fi
>  done <builtins
>  
> diff --git a/t/t0450/txt-help-mismatches b/t/t0450/adoc-help-mismatches
> similarity index 100%
> rename from t/t0450/txt-help-mismatches
> rename to t/t0450/adoc-help-mismatches
Todd Zullinger March 3, 2025, 10:28 p.m. UTC | #2
Junio C Hamano wrote:
> Todd Zullinger <tmz@pobox.com> writes:
> 
>> After 1f010d6bdf (doc: use .adoc extension for AsciiDoc files,
>> 2025-01-20), we no longer matched any files in this test.  The result is
>> that we did not test for mismatches in the documentation and --help
>> output.
>>
>> Adjust the test to look at the renamed *.adoc files.
>>
>> Signed-off-by: Todd Zullinger <tmz@pobox.com>
>> ---
>>  t/t0450-txt-doc-vs-help.sh                    | 50 +++++++++----------
>>  ...t-help-mismatches => adoc-help-mismatches} |  0
>>  2 files changed, 25 insertions(+), 25 deletions(-)
>>  rename t/t0450/{txt-help-mismatches => adoc-help-mismatches} (100%)
> 
> Wow, good find.  This is especially bad and I am glad we caught it
> before -rc1 (the hope was that all of these should have been caught
> while the topic was in 'next', which was the whole point of cooking
> it longer in 'next' than usual, but that plan did not really work).

Indeed.  I haven't looked closely at the CI bits to see how
we might be able to improve this.  When we skip tests
unintentionally we just don't see that currently.

I have a file of patterns I expected to skip in the rpm
builds when I maintained git in Fedora.  I'd regularly run:

     grep -E '# SKIP|skipped:' build.log | grep -Evf git.skip-test-patterns

to watch for skipped tests[1].  Those often indicated that I
needed to add a new build dependency, but sometimes catch
issues like this.  We have some similar things in the CI
scripts, I think.  Maybe we could add one for this sort of
thing.

What I don't know is how many tests we skip now and how
those differ across the multiple test runs.  It might be
annoyingly variable to track what is skipped between the
multiple OS types, releases, and build options.

I don't even know if we have the same data in the build
logs.  The rpm builds I run use `prove` with verbose output.

[1] That is also how I noticed that we've been skipping all
    tests which rely on the GPG2 prereq, as I mentioned
    recently in <Z8HVkqqD054QGPIE@teonanacatl.net>.
Junio C Hamano March 3, 2025, 10:55 p.m. UTC | #3
Todd Zullinger <tmz@pobox.com> writes:

> Indeed.  I haven't looked closely at the CI bits to see how
> we might be able to improve this.  When we skip tests
> unintentionally we just don't see that currently.

In any case, while the t0450 was inadvertently disabled this way, a
topic seems to have escaped to 'master' already with an inconsistent
synopsis section and help text.

Here is a fix.

--- >8 ---
Subject: [PATCH] refs: show --no-reflog in the help text

We forgot that we must keep the documentation and help text in sync.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/refs.c b/builtin/refs.c
index c459507d51..44d592a94c 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -8,7 +8,7 @@
 #include "worktree.h"
 
 #define REFS_MIGRATE_USAGE \
-	N_("git refs migrate --ref-format=<format> [--dry-run]")
+	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
 
 #define REFS_VERIFY_USAGE \
 	N_("git refs verify [--strict] [--verbose]")
Todd Zullinger March 4, 2025, 12:15 a.m. UTC | #4
Junio C Hamano wrote:
> Todd Zullinger <tmz@pobox.com> writes:
> 
>> Indeed.  I haven't looked closely at the CI bits to see how
>> we might be able to improve this.  When we skip tests
>> unintentionally we just don't see that currently.
> 
> In any case, while the t0450 was inadvertently disabled this way, a
> topic seems to have escaped to 'master' already with an inconsistent
> synopsis section and help text.
> 
> Here is a fix.

I'm glad that's already paying off; it helps prove the patch
nicely.

I wondered for a moment why I didn't catch it with any of my
test runs.  But it's simply that the rpm build tests were on
top of 2.49.0-rc0 and my local branch for this was built on
top of tz/doc-txt-to-adoc-fixes, neither of which contain
89be7d2774 (builtin/refs: add '--no-reflog' flag to drop
reflogs, 2025-02-21).

> --- >8 ---
> Subject: [PATCH] refs: show --no-reflog in the help text
> 
> We forgot that we must keep the documentation and help text in sync.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  builtin/refs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/refs.c b/builtin/refs.c
> index c459507d51..44d592a94c 100644
> --- a/builtin/refs.c
> +++ b/builtin/refs.c
> @@ -8,7 +8,7 @@
>  #include "worktree.h"
>  
>  #define REFS_MIGRATE_USAGE \
> -	N_("git refs migrate --ref-format=<format> [--dry-run]")
> +	N_("git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]")
>  
>  #define REFS_VERIFY_USAGE \
>  	N_("git refs verify [--strict] [--verbose]")

The fix looks obviously correct. :)
diff mbox series

Patch

diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
index 853101b86e..2f7504ae7e 100755
--- a/t/t0450-txt-doc-vs-help.sh
+++ b/t/t0450-txt-doc-vs-help.sh
@@ -1,6 +1,6 @@ 
 #!/bin/sh
 
-test_description='assert (unbuilt) Documentation/*.txt and -h output
+test_description='assert (unbuilt) Documentation/*.adoc and -h output
 
 Run this with --debug to see a summary of where we still fail to make
 the two versions consistent with one another.'
@@ -11,11 +11,11 @@  test_expect_success 'setup: list of builtins' '
 	git --list-cmds=builtins >builtins
 '
 
-test_expect_success 'list of txt and help mismatches is sorted' '
-	sort -u "$TEST_DIRECTORY"/t0450/txt-help-mismatches >expect &&
-	if ! test_cmp expect "$TEST_DIRECTORY"/t0450/txt-help-mismatches
+test_expect_success 'list of adoc and help mismatches is sorted' '
+	sort -u "$TEST_DIRECTORY"/t0450/adoc-help-mismatches >expect &&
+	if ! test_cmp expect "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
 	then
-		BUG "please keep the list of txt and help mismatches sorted"
+		BUG "please keep the list of adoc and help mismatches sorted"
 	fi
 '
 
@@ -40,20 +40,20 @@  help_to_synopsis () {
 	echo "$out"
 }
 
-builtin_to_txt () {
-       echo "$GIT_BUILD_DIR/Documentation/git-$1.txt"
+builtin_to_adoc () {
+       echo "$GIT_BUILD_DIR/Documentation/git-$1.adoc"
 }
 
-txt_to_synopsis () {
+adoc_to_synopsis () {
 	builtin="$1" &&
 	out_dir="out/$builtin" &&
-	out="$out_dir/txt.synopsis" &&
+	out="$out_dir/adoc.synopsis" &&
 	if test -f "$out"
 	then
 		echo "$out" &&
 		return 0
 	fi &&
-	b2t="$(builtin_to_txt "$builtin")" &&
+	b2t="$(builtin_to_adoc "$builtin")" &&
 	sed -n \
 		-E '/^\[(verse|synopsis)\]$/,/^$/ {
 			/^$/d;
@@ -109,29 +109,29 @@  do
 		fi
 	'
 
-	txt="$(builtin_to_txt "$builtin")" &&
-	preq="$(echo BUILTIN_TXT_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
+	adoc="$(builtin_to_adoc "$builtin")" &&
+	preq="$(echo BUILTIN_ADOC_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
 
-	if test -f "$txt"
+	if test -f "$adoc"
 	then
 		test_set_prereq "$preq"
 	fi &&
 
-	# *.txt output assertions
-	test_expect_success "$preq" "$builtin *.txt SYNOPSIS has dashed labels" '
-		check_dashed_labels "$(txt_to_synopsis "$builtin")"
+	# *.adoc output assertions
+	test_expect_success "$preq" "$builtin *.adoc SYNOPSIS has dashed labels" '
+		check_dashed_labels "$(adoc_to_synopsis "$builtin")"
 	'
 
-	# *.txt output consistency assertions
+	# *.adoc output consistency assertions
 	result=
-	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/txt-help-mismatches
+	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
 	then
 		result=failure
 	else
 		result=success
 	fi &&
 	test_expect_$result "$preq" "$builtin -h output and SYNOPSIS agree" '
-		t2s="$(txt_to_synopsis "$builtin")" &&
+		t2s="$(adoc_to_synopsis "$builtin")" &&
 		if test "$builtin" = "merge-tree"
 		then
 			test_when_finished "rm -f t2s.new" &&
@@ -140,17 +140,17 @@  do
 		fi &&
 		h2s="$(help_to_synopsis "$builtin")" &&
 
-		# The *.txt and -h use different spacing for the
+		# The *.adoc and -h use different spacing for the
 		# alignment of continued usage output, normalize it.
-		align_after_nl "$builtin" <"$t2s" >txt &&
+		align_after_nl "$builtin" <"$t2s" >adoc &&
 		align_after_nl "$builtin" <"$h2s" >help &&
-		test_cmp txt help
+		test_cmp adoc help
 	'
 
-	if test_have_prereq "$preq" && test -e txt && test -e help
+	if test_have_prereq "$preq" && test -e adoc && test -e help
 	then
 		test_debug '
-			if test_cmp txt help >cmp 2>/dev/null
+			if test_cmp adoc help >cmp 2>/dev/null
 			then
 				echo "=== DONE: $builtin ==="
 			else
@@ -161,7 +161,7 @@  do
 
 		# Not in test_expect_success in case --run is being
 		# used with --debug
-		rm -f txt help tmp 2>/dev/null
+		rm -f adoc help tmp 2>/dev/null
 	fi
 done <builtins
 
diff --git a/t/t0450/txt-help-mismatches b/t/t0450/adoc-help-mismatches
similarity index 100%
rename from t/t0450/txt-help-mismatches
rename to t/t0450/adoc-help-mismatches