Skip to contentSkip to conversation

guides: keep Documentation/Makefile and command-list.txt in sync

PATCH Superseded Tuomas Ahola 3 participants 17 messages Sep 9 – Nov 11 Documentation

lore
Share & tools
lore
#0 lore raw

cover guides: keep Documentation/Makefile and command-list.txt in sync

Documentation/lint-manpages.sh was expanded with a new test ensuring that command-list.txt also includes all non-command manual pages (concept guides and interface manuals).

Based on kh/doc-datamodel.

Tuomas Ahola (2):
command-list: add gitformat-loose(5) and gitpacking(7)
lint-docs: check the guide list in command-list.txt

 Documentation/Makefile         | 2 ++
 Documentation/lint-manpages.sh | 9 ++++++---
 command-list.txt               | 2 ++
 3 files changed, 10 insertions(+), 3 deletions(-)

base-commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc
prerequisite-patch-id: 13af80fdddfc7d4f65437343cee0ca3787cbdea4

Signature · 1 line
ta/command-list-guides-sync-lint
#1 lore raw

PATCH 1/2 command-list: add gitformat-loose(5) and gitpacking(7)

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)
command-list.txt +2 -0
index 63ae2a67c9..955eec6e7e 100644
@@ -225,6 +225,7 @@ gitformat-bundle                        developerinterfaces
 gitformat-chunk                         developerinterfaces
 gitformat-commit-graph                  developerinterfaces
 gitformat-index                         developerinterfaces
+gitformat-loose                         developerinterfaces
 gitformat-pack                          developerinterfaces
 gitformat-signature                     developerinterfaces
 gitglossary                             guide
@@ -234,6 +235,7 @@ gitk                                    mainporcelain
 gitmailmap                              userinterfaces
 gitmodules                              userinterfaces
 gitnamespaces                           guide
+gitpacking                              guide
 gitprotocol-capabilities                developerinterfaces
 gitprotocol-common                      developerinterfaces
 gitprotocol-http                        developerinterfaces
Signature · 1 line
ta/command-list-guides-sync-lint
#2 lore raw

Re: [PATCH 1/2] command-list: add gitformat-loose(5) and gitpacking(7)

Quoted 11 lines · Tuomas Ahola

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

Quoted 4 lines
---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)

Good eyes. Thanks.

Quoted 21 lines
command-list.txt +2 -0
index 63ae2a67c9..955eec6e7e 100644
@@ -225,6 +225,7 @@ gitformat-bundle                        developerinterfaces
 gitformat-chunk                         developerinterfaces
 gitformat-commit-graph                  developerinterfaces
 gitformat-index                         developerinterfaces
+gitformat-loose                         developerinterfaces
 gitformat-pack                          developerinterfaces
 gitformat-signature                     developerinterfaces
 gitglossary                             guide
@@ -234,6 +235,7 @@ gitk                                    mainporcelain
 gitmailmap                              userinterfaces
 gitmodules                              userinterfaces
 gitnamespaces                           guide
+gitpacking                              guide
 gitprotocol-capabilities                developerinterfaces
 gitprotocol-common                      developerinterfaces
 gitprotocol-http                        developerinterfaces
#3 lore raw

PATCH 2/2 lint-docs: check the guide list in command-list.txt

In reply to Tuomas Ahola

Since 2135e1ad70 (command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers', 2020-08-05) there has been a comment in Documentation/Makefile reminding developers to add new guides also to command-list.txt. However, there is no linter script to enforce that.

Adapt Documentation/lint-manpages.sh to fill that role. Extract MAN5_TXT and MAN7_TXT from the Makefile and check command-list.txt against them. Exempt gitweb.conf(5) from the new linter routine.

---

Notes:
c655855559 (doc: git: list gitdatamodel(7) as a concept guide, 2026-09-05) should be merged in to make the new test pass.

 Documentation/Makefile         | 2 ++
 Documentation/lint-manpages.sh | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
Documentation/Makefile +2 -0
index 2699f0b24a..203f6a0c31 100644
@@ -67,6 +67,8 @@ MAN7_TXT += gittutorial-2.adoc
 MAN7_TXT += gittutorial.adoc
 MAN7_TXT += gitworkflows.adoc
 
+MAN_GUIDES = $(patsubst %.adoc,%,$(MAN5_TXT) $(MAN7_TXT))
+
 HOWTO_TXT += $(wildcard howto/*.adoc)
 
 DOC_DEP_TXT += $(wildcard *.adoc)
Documentation/lint-manpages.sh +6 -3
index a0ea572382..290ebe0947 100755
@@ -1,21 +1,22 @@
 #!/bin/sh
 
 extract_variable () {
+	file=${2:-../Makefile}
 	(
-		cat ../Makefile
+		cat $file
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C $(dirname $file) -f - print_variable 2>/dev/null |
 	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
 }
 
 check_missing_docs () (
 	ret=0
 
-	for v in $ALL_COMMANDS
+	for v in $ALL_COMMANDS $MAN_GUIDES
 	do
 		case "$v" in
 		git-merge-octopus) continue;;
@@ -29,6 +30,7 @@ check_missing_docs () (
 		git-stage) continue;;
 		git-legacy-*) continue;;
 		git-?*--?* ) continue ;;
+		gitweb.conf) continue ;;
 		esac
 
 		if ! test -f "$v.adoc"
@@ -87,6 +89,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"
 
 findings=$(
 	if ! check_missing_docs
Signature · 1 line
ta/command-list-guides-sync-lint
#4 lore raw

Re: [PATCH 2/2] lint-docs: check the guide list in command-list.txt

Documentation/lint-manpages.sh line 6

Quoted 5 lines · Tuomas Ahola

extract_variable () {

Documentation/lint-manpages.sh +2 -1
+	file=${2:-../Makefile}
 	(
-		cat ../Makefile
+		cat $file

Now you are allowing arbitrary path to be fed to this function, you should prepare to accept arbitrary path, without assuming that $file has no $IFS whitespaces. I.e.,

		cat "$file"

Documentation/lint-manpages.sh line 12

Quoted 3 lines
Documentation/lint-manpages.sh +1 -1
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C $(dirname $file) -f - print_variable 2>/dev/null |

Ditto. $file itself may have $IFS whitespaces, and the result of running dirname on it may too.

#5 lore raw

v2 cover guides: keep Documentation/Makefile and command-list.txt in sync

In reply to Tuomas Ahola

Documentation/lint-manpages.sh was expanded with a new test ensuring that command-list.txt also includes all non-command manual pages (concept guides and interface manuals).

Based on kh/doc-datamodel.

Changes in v2:

* [1/2]: Use command-list.txt as the area identifier.
* [2/2]: Protect variables againtst whitespace breakage per review comment.

Tuomas Ahola (2):
command-list.txt: add gitformat-loose(5) and gitpacking(7)
lint-docs: check the guide list in command-list.txt

 Documentation/Makefile         |  2 ++
 Documentation/lint-manpages.sh | 10 +++++++---
 command-list.txt               |  2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

Intervall-diff mot v1:
1: 014da7fdff ! 1: cb6ce6cad1 command-list: add gitformat-loose(5) and gitpacking(7)
@@ Metadata
Author: Tuomas Ahola <[email protected]>

## Commit message ##
- command-list: add gitformat-loose(5) and gitpacking(7)
+ command-list.txt: add gitformat-loose(5) and gitpacking(7)

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.
2: b24d96f732 ! 2: 2dc1ee4514 lint-docs: check the guide list in command-list.txt

    @@ Documentation/lint-manpages.sh
      
      extract_variable () {
     +	file=${2:-../Makefile}
    ++	directory=$(dirname "$file")
      	(
     -		cat ../Makefile
    -+		cat $file
    ++		cat "$file"
      		cat <<EOF
      print_variable:
      	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
      EOF
      	) |
     -	make -C .. -f - print_variable 2>/dev/null |
    -+	make -C $(dirname $file) -f - print_variable 2>/dev/null |
    ++	make -C "$directory" -f - print_variable 2>/dev/null |
      	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
      }

base-commit: b8242b093d9e941a34460d715e3ce616a34ac3fe

Signature · 1 line
ta/command-list-guides-sync-lint
#6 lore raw

PATCH v2 1/2 command-list.txt: add gitformat-loose(5) and gitpacking(7)

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)
command-list.txt +2 -0
index 21b802c420..6667930e8f 100644
@@ -224,6 +224,7 @@ gitformat-bundle                        developerinterfaces
 gitformat-chunk                         developerinterfaces
 gitformat-commit-graph                  developerinterfaces
 gitformat-index                         developerinterfaces
+gitformat-loose                         developerinterfaces
 gitformat-pack                          developerinterfaces
 gitformat-signature                     developerinterfaces
 gitglossary                             guide
@@ -233,6 +234,7 @@ gitk                                    mainporcelain
 gitmailmap                              userinterfaces
 gitmodules                              userinterfaces
 gitnamespaces                           guide
+gitpacking                              guide
 gitprotocol-capabilities                developerinterfaces
 gitprotocol-common                      developerinterfaces
 gitprotocol-http                        developerinterfaces
Signature · 1 line
ta/command-list-guides-sync-lint
#7 lore raw

PATCH v2 2/2 lint-docs: check the guide list in command-list.txt

In reply to Tuomas Ahola

Since 2135e1ad70 (command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers', 2020-08-05) there has been a comment in Documentation/Makefile reminding developers to add new guides also to command-list.txt. However, there is no linter script to enforce that.

Adapt Documentation/lint-manpages.sh to fill that role. Extract MAN5_TXT and MAN7_TXT from the Makefile and check command-list.txt against them. Exempt gitweb.conf(5) from the new linter routine.

---

Notes:
c655855559 (doc: git: list gitdatamodel(7) as a concept guide, 2026-09-05) should be merged in to make the new test pass.

 Documentation/Makefile         |  2 ++
 Documentation/lint-manpages.sh | 10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
Documentation/Makefile +2 -0
index f8dea4b395..8e28ac784b 100644
@@ -67,6 +67,8 @@ MAN7_TXT += gittutorial-2.adoc
 MAN7_TXT += gittutorial.adoc
 MAN7_TXT += gitworkflows.adoc
 
+MAN_GUIDES = $(patsubst %.adoc,%,$(MAN5_TXT) $(MAN7_TXT))
+
 HOWTO_TXT += $(wildcard howto/*.adoc)
 
 DOC_DEP_TXT += $(wildcard *.adoc)
Documentation/lint-manpages.sh +7 -3
index a0ea572382..d4a1977ba6 100755
@@ -1,21 +1,23 @@
 #!/bin/sh
 
 extract_variable () {
+	file=${2:-../Makefile}
+	directory=$(dirname "$file")
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C "$directory" -f - print_variable 2>/dev/null |
 	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
 }
 
 check_missing_docs () (
 	ret=0
 
-	for v in $ALL_COMMANDS
+	for v in $ALL_COMMANDS $MAN_GUIDES
 	do
 		case "$v" in
 		git-merge-octopus) continue;;
@@ -29,6 +31,7 @@ check_missing_docs () (
 		git-stage) continue;;
 		git-legacy-*) continue;;
 		git-?*--?* ) continue ;;
+		gitweb.conf) continue ;;
 		esac
 
 		if ! test -f "$v.adoc"
@@ -87,6 +90,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"
 
 findings=$(
 	if ! check_missing_docs
Signature · 1 line
ta/command-list-guides-sync-lint
#8 lore raw

v3 cover guides: keep Documentation/Makefile and command-list.txt in sync

In reply to Tuomas Ahola

A new linter test has been added to Documentation/lint-manpages.sh to ensure that all non-command manual pages (concept guides and interface manuals) listed in Documentation/Makefile are present in command-list.txt.

Changes in v3:

* [2/2]:
- Exempt obsoleted gittutorial-2(7).
- Even more defensive quotation.

Changes in v2:

* [1/2]: Use command-list.txt as the area identifier.
* [2/2]: Protect variables againtst whitespace breakage per review comment.

synthetic-base: master + je/doc-remove-gittutorial-2

Tuomas Ahola (2):
command-list.txt: add gitformat-loose(5) and gitpacking(7)
lint-docs: check the guide list in command-list.txt

 Documentation/Makefile         |  2 ++
 Documentation/lint-manpages.sh | 11 ++++++++---
 command-list.txt               |  2 ++
 3 files changed, 12 insertions(+), 3 deletions(-)

Intervall-diff mot v2:

1:  cb6ce6cad1 = 1:  9a1ba61ac0 command-list.txt: add gitformat-loose(5) and gitpacking(7)
2:  2dc1ee4514 ! 2:  5d36d75859 lint-docs: check the guide list in command-list.txt
    @@ Commit message
     
         Adapt Documentation/lint-manpages.sh to fill that role.  Extract
         MAN5_TXT and MAN7_TXT from the Makefile and check command-list.txt
    -    against them.  Exempt gitweb.conf(5) from the new linter routine.
    +    against them.  Exempt gitweb.conf(5) and gittutorial-2(7) from the
    +    new linter routine.
     
         Signed-off-by: Tuomas Ahola <[email protected]>
     
    @@ Documentation/lint-manpages.sh
      #!/bin/sh
      
      extract_variable () {
    -+	file=${2:-../Makefile}
    -+	directory=$(dirname "$file")
    ++	file="${2:-../Makefile}"
    ++	directory="$(dirname "$file")"
      	(
     -		cat ../Makefile
     +		cat "$file"
    @@ Documentation/lint-manpages.sh: check_missing_docs () (
      		git-stage) continue;;
      		git-legacy-*) continue;;
      		git-?*--?* ) continue ;;
    ++		gittutorial-2) continue ;;
     +		gitweb.conf) continue ;;
      		esac

base-commit: b9e5cff1803ab24582201ef059516eb16014b9d9
prerequisite-patch-id: 7f3cc00ab656bf1192d93c2e6a434c0d0fda2b6b
prerequisite-patch-id: eb8fbd9fc3f96e3cbffddbeaf47b99f397e5330b

Signature · 1 line
ta/command-list-guides-sync-lint
#9 lore raw

PATCH v3 1/2 command-list.txt: add gitformat-loose(5) and gitpacking(7)

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)
command-list.txt +2 -0
index 5c649c882e..d96f56a379 100644
@@ -225,6 +225,7 @@ gitformat-bundle                        developerinterfaces
 gitformat-chunk                         developerinterfaces
 gitformat-commit-graph                  developerinterfaces
 gitformat-index                         developerinterfaces
+gitformat-loose                         developerinterfaces
 gitformat-pack                          developerinterfaces
 gitformat-signature                     developerinterfaces
 gitglossary                             guide
@@ -234,6 +235,7 @@ gitk                                    mainporcelain
 gitmailmap                              userinterfaces
 gitmodules                              userinterfaces
 gitnamespaces                           guide
+gitpacking                              guide
 gitprotocol-capabilities                developerinterfaces
 gitprotocol-common                      developerinterfaces
 gitprotocol-http                        developerinterfaces
Signature · 1 line
ta/command-list-guides-sync-lint
#10 lore raw

Re: [PATCH v3 1/2] command-list.txt: add gitformat-loose(5) and gitpacking(7)

Quoted 11 lines · Tuomas Ahola

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

Quoted 4 lines
---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)

I agree we can decide what to do about gitweb. Is the list otherwise complete to cover the available documents in .adoc format?

Thanks.

Quoted 21 lines
command-list.txt +2 -0
index 5c649c882e..d96f56a379 100644
@@ -225,6 +225,7 @@ gitformat-bundle                        developerinterfaces
 gitformat-chunk                         developerinterfaces
 gitformat-commit-graph                  developerinterfaces
 gitformat-index                         developerinterfaces
+gitformat-loose                         developerinterfaces
 gitformat-pack                          developerinterfaces
 gitformat-signature                     developerinterfaces
 gitglossary                             guide
@@ -234,6 +235,7 @@ gitk                                    mainporcelain
 gitmailmap                              userinterfaces
 gitmodules                              userinterfaces
 gitnamespaces                           guide
+gitpacking                              guide
 gitprotocol-capabilities                developerinterfaces
 gitprotocol-common                      developerinterfaces
 gitprotocol-http                        developerinterfaces
#11 lore raw

Re: [PATCH v3 1/2] command-list.txt: add gitformat-loose(5) and gitpacking(7)

Quoted 13 lines · Junio C Hamano
Quoted 11 lines · Tuomas Ahola

Three manpages from sections 5 and 7 are not featured in command-list.txt as concept guides or interface manuals.

As easy fixes, add gitformat-loose(5) to 'developerinterfaces' and make gitpacking(7) a 'guide'.

That leaves only gitweb.conf(5) which could be added to 'userinterfaces'. However, the manual would then appear as "web.conf" in git help -a which is just confusing. So, perhaps we are better off by leaving it out.

Quoted 8 lines
Quoted 4 lines
---
 command-list.txt | 2 ++
 1 file changed, 2 insertions(+)

I agree we can decide what to do about gitweb. Is the list otherwise complete to cover the available documents in .adoc format?

AFAIK, yes.

#12 lore raw

PATCH v3 2/2 lint-docs: check the guide list in command-list.txt

In reply to Tuomas Ahola

Since 2135e1ad70 (command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers', 2020-08-05) there has been a comment in Documentation/Makefile reminding developers to add new guides also to command-list.txt. However, there is no linter script to enforce that.

Adapt Documentation/lint-manpages.sh to fill that role. Extract MAN5_TXT and MAN7_TXT from the Makefile and check command-list.txt against them. Exempt gitweb.conf(5) and gittutorial-2(7) from the new linter routine.

---
 Documentation/Makefile         |  2 ++
 Documentation/lint-manpages.sh | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
Documentation/Makefile +2 -0
index f8dea4b395..8e28ac784b 100644
@@ -67,6 +67,8 @@ MAN7_TXT += gittutorial-2.adoc
 MAN7_TXT += gittutorial.adoc
 MAN7_TXT += gitworkflows.adoc
 
+MAN_GUIDES = $(patsubst %.adoc,%,$(MAN5_TXT) $(MAN7_TXT))
+
 HOWTO_TXT += $(wildcard howto/*.adoc)
 
 DOC_DEP_TXT += $(wildcard *.adoc)
Documentation/lint-manpages.sh +8 -3
index a0ea572382..31ee3cbe72 100755
@@ -1,21 +1,23 @@
 #!/bin/sh
 
 extract_variable () {
+	file="${2:-../Makefile}"
+	directory="$(dirname "$file")"
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C "$directory" -f - print_variable 2>/dev/null |
 	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
 }
 
 check_missing_docs () (
 	ret=0
 
-	for v in $ALL_COMMANDS
+	for v in $ALL_COMMANDS $MAN_GUIDES
 	do
 		case "$v" in
 		git-merge-octopus) continue;;
@@ -29,6 +31,8 @@ check_missing_docs () (
 		git-stage) continue;;
 		git-legacy-*) continue;;
 		git-?*--?* ) continue ;;
+		gittutorial-2) continue ;;
+		gitweb.conf) continue ;;
 		esac
 
 		if ! test -f "$v.adoc"
@@ -87,6 +91,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"
 
 findings=$(
 	if ! check_missing_docs
Signature · 1 line
ta/command-list-guides-sync-lint
#13 lore raw

Re: [PATCH v3 2/2] lint-docs: check the guide list in command-list.txt

Quoted 34 lines · Tuomas Ahola

Since 2135e1ad70 (command-list.txt: add missing 'gitcredentials' and 'gitremote-helpers', 2020-08-05) there has been a comment in Documentation/Makefile reminding developers to add new guides also to command-list.txt. However, there is no linter script to enforce that.

Adapt Documentation/lint-manpages.sh to fill that role. Extract MAN5_TXT and MAN7_TXT from the Makefile and check command-list.txt against them. Exempt gitweb.conf(5) and gittutorial-2(7) from the new linter routine.

---
 Documentation/Makefile         |  2 ++
 Documentation/lint-manpages.sh | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
Documentation/Makefile +2 -0
index f8dea4b395..8e28ac784b 100644
@@ -67,6 +67,8 @@ MAN7_TXT += gittutorial-2.adoc
 MAN7_TXT += gittutorial.adoc
 MAN7_TXT += gitworkflows.adoc
 
+MAN_GUIDES = $(patsubst %.adoc,%,$(MAN5_TXT) $(MAN7_TXT))
+
 HOWTO_TXT += $(wildcard howto/*.adoc)
 
 DOC_DEP_TXT += $(wildcard *.adoc)
Documentation/lint-manpages.sh +0 -0
index a0ea572382..31ee3cbe72 100755

Documentation/lint-manpages.sh line 4

Quoted 4 lines
Documentation/lint-manpages.sh +1 -0
@@ -1,21 +1,23 @@
 #!/bin/sh
 
 extract_variable () {
+	file="${2:-../Makefile}"

I think what's happening here is that previously we were getting the variables from ./Makefile (in the basedir), but now we need some variables from ./Makefile and some from Documentation/Makefile.

Would it make sense to get all the variables from Documentation/Makefile?

Quoted 41 lines
Documentation/lint-manpages.sh +7 -3
+	directory="$(dirname "$file")"
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C "$directory" -f - print_variable 2>/dev/null |
 	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
 }
 
 check_missing_docs () (
 	ret=0
 
-	for v in $ALL_COMMANDS
+	for v in $ALL_COMMANDS $MAN_GUIDES
 	do
 		case "$v" in
 		git-merge-octopus) continue;;
@@ -29,6 +31,8 @@ check_missing_docs () (
 		git-stage) continue;;
 		git-legacy-*) continue;;
 		git-?*--?* ) continue ;;
+		gittutorial-2) continue ;;
+		gitweb.conf) continue ;;
 		esac
 
 		if ! test -f "$v.adoc"
@@ -87,6 +91,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"
 
 findings=$(
 	if ! check_missing_docs
Signature · 1 line
ta/command-list-guides-sync-lint
#14 lore raw

Re: [PATCH v3 2/2] lint-docs: check the guide list in command-list.txt

Quoted 8 lines · Julia Evans
Quoted 7 lines · Tuomas Ahola
Documentation/lint-manpages.sh +0 -0
index a0ea572382..31ee3cbe72 100755
@@ -1,21 +1,23 @@
 #!/bin/sh
 
Quoted 9 lines

Documentation/lint-manpages.sh line 4

Quoted 2 lines
Documentation/lint-manpages.sh +1 -0
 extract_variable () {
+	file="${2:-../Makefile}"

I think what's happening here is that previously we were getting the variables from ./Makefile (in the basedir), but now we need some variables from ./Makefile and some from Documentation/Makefile.

Would it make sense to get all the variables from Documentation/Makefile?

If that's possible, then sure, why not. But I think we are mostly extracting from the top-level Makefile such information that simply isn't available in the docs Makefile (and vice versa)?

Quoted 41 lines
Quoted 41 lines
Documentation/lint-manpages.sh +7 -3
+	directory="$(dirname "$file")"
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C "$directory" -f - print_variable 2>/dev/null |
 	sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
 }
 
 check_missing_docs () (
 	ret=0
 
-	for v in $ALL_COMMANDS
+	for v in $ALL_COMMANDS $MAN_GUIDES
 	do
 		case "$v" in
 		git-merge-octopus) continue;;
@@ -29,6 +31,8 @@ check_missing_docs () (
 		git-stage) continue;;
 		git-legacy-*) continue;;
 		git-?*--?* ) continue ;;
+		gittutorial-2) continue ;;
+		gitweb.conf) continue ;;
 		esac
 
 		if ! test -f "$v.adoc"
@@ -87,6 +91,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"
 
 findings=$(
 	if ! check_missing_docs
Signature · 1 line
ta/command-list-guides-sync-lint
#15 lore raw

Re: [PATCH v3 2/2] lint-docs: check the guide list in command-list.txt

In reply to Tuomas Ahola

Documentation/lint-manpages.sh line 13

Quoted 13 lines · Tuomas Ahola

extract_variable () {

Documentation/lint-manpages.sh +4 -2
+	file="${2:-../Makefile}"
+	directory="$(dirname "$file")"
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
+	make -C "$directory" -f - print_variable 2>/dev/null |

I like this sayIt pattern to prepend a snippet in front of the Makefile. As we allow extracting from different Makefile with this change, it would make more sense to (1) make the path to the Makefile mandatory, (2) move the path to the Makefile first, and (3) use not just the $1 but all the remainder of the command line as listing the symbols we are inquiring.

which would mean ...

Documentation/lint-manpages.sh check_extraneous_docs () { · line 94

Quoted 5 lines
Documentation/lint-manpages.sh +1 -0
@@ -87,6 +91,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"

These would become

    BUILT_INS="$(extract_variable ../Makefile BUILT_INS)"
    ALL_COMMANDS="$(extract_variable ../Makefile ALL_COMMANDS)"
    EXCLUDED_PROGRAMS="$(extract_variable ../Makefile EXCLUDED_PROGRAMS)"
    MAN_GUIDES="$(extract_variable Makefile MAN_GUIDES)"

Other than that, looking good.

Thanks.

#16 lore raw

Re: [PATCH v3 2/2] lint-docs: check the guide list in command-list.txt

Quoted 14 lines · Junio C Hamano
Quoted 12 lines · Tuomas Ahola

extract_variable () {

Documentation/lint-manpages.sh +3 -2
+	file="${2:-../Makefile}"
+	directory="$(dirname "$file")"
 	(
-		cat ../Makefile
+		cat "$file"
 		cat <<EOF
 print_variable:
 	@\$(foreach b,\$($1),echo XXX \$(b:\$X=) YYY;)
 EOF
 	) |
-	make -C .. -f - print_variable 2>/dev/null |
Quoted 9 lines

Documentation/lint-manpages.sh line 13

Quoted 1 line
Documentation/lint-manpages.sh +1 -0
+	make -C "$directory" -f - print_variable 2>/dev/null |

I like this sayIt pattern to prepend a snippet in front of the Makefile. As we allow extracting from different Makefile with this change, it would make more sense to (1) make the path to the Makefile mandatory, (2) move the path to the Makefile first, and (3) use not just the $1 but all the remainder of the command line as listing the symbols we are inquiring.

Hmm, sounds sensible.

Quoted 10 lines

which would mean ...

Documentation/lint-manpages.sh check_extraneous_docs () { · line 94

Quoted 5 lines
Documentation/lint-manpages.sh +1 -0
@@ -87,6 +91,7 @@ check_extraneous_docs () {
 BUILT_INS="$(extract_variable BUILT_INS)"
 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
+MAN_GUIDES="$(extract_variable MAN_GUIDES ./Makefile)"

These would become

Quoted 5 lines
    BUILT_INS="$(extract_variable ../Makefile BUILT_INS)"
    ALL_COMMANDS="$(extract_variable ../Makefile ALL_COMMANDS)"
    EXCLUDED_PROGRAMS="$(extract_variable ../Makefile EXCLUDED_PROGRAMS)"
    MAN_GUIDES="$(extract_variable Makefile MAN_GUIDES)"

Okay, I'll do that.

Quoted 5 lines

Other than that, looking good.

Thanks.