Git fork

Documentation: refactor "howto-index.sh" for out-of-tree builds

The "howto-index.sh" is used to generate an index of our how-to docs. It
receives as input the paths to these documents, which would typically be
relative to the "Documentation/" directory in Makefile-based builds. In
an out-of-tree build though it will get relative that may be rooted
somewhere else entirely.

The file paths do end up in the generated index, and the expectation is
that they should always start with "howto/". But for out-of-tree builds
we would populate it with the paths relative to the build directory,
which is wrong.

Fix the issue by using `$(basename "$file")` to generate the path. While
at it, move the script into "howto/" to align it with the location of
the comparable "api-index.sh" script.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
8922506c 88e08b92

+58 -58
+2 -2
Documentation/Makefile
··· 411 411 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml 412 412 $(QUIET_DB2TEXI)$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@ 413 413 414 - howto-index.txt: howto-index.sh $(HOWTO_TXT) 415 - $(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@ 414 + howto-index.txt: howto/howto-index.sh $(HOWTO_TXT) 415 + $(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto/howto-index.sh $(sort $(HOWTO_TXT)) >$@ 416 416 417 417 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS) 418 418 $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
-56
Documentation/howto-index.sh
··· 1 - #!/bin/sh 2 - 3 - cat <<\EOF 4 - Git Howto Index 5 - =============== 6 - 7 - Here is a collection of mailing list postings made by various 8 - people describing how they use Git in their workflow. 9 - 10 - EOF 11 - 12 - for txt 13 - do 14 - title=$(expr "$txt" : '.*/\(.*\)\.txt$') 15 - from=$(sed -ne ' 16 - /^$/q 17 - /^From:[ ]/{ 18 - s/// 19 - s/^[ ]*// 20 - s/[ ]*$// 21 - s/^/by / 22 - p 23 - } 24 - ' "$txt") 25 - 26 - abstract=$(sed -ne ' 27 - /^Abstract:[ ]/{ 28 - s/^[^ ]*// 29 - x 30 - s/.*// 31 - x 32 - : again 33 - /^[ ]/{ 34 - s/^[ ]*// 35 - H 36 - n 37 - b again 38 - } 39 - x 40 - p 41 - q 42 - }' "$txt") 43 - 44 - if grep 'Content-type: text/asciidoc' >/dev/null $txt 45 - then 46 - file=$(expr "$txt" : '\(.*\)\.txt$').html 47 - else 48 - file="$txt" 49 - fi 50 - 51 - echo "* link:$file[$title] $from 52 - $abstract 53 - 54 - " 55 - 56 - done
+56
Documentation/howto/howto-index.sh
··· 1 + #!/bin/sh 2 + 3 + cat <<\EOF 4 + Git Howto Index 5 + =============== 6 + 7 + Here is a collection of mailing list postings made by various 8 + people describing how they use Git in their workflow. 9 + 10 + EOF 11 + 12 + for txt 13 + do 14 + title=$(expr "$txt" : '.*/\(.*\)\.txt$') 15 + from=$(sed -ne ' 16 + /^$/q 17 + /^From:[ ]/{ 18 + s/// 19 + s/^[ ]*// 20 + s/[ ]*$// 21 + s/^/by / 22 + p 23 + } 24 + ' "$txt") 25 + 26 + abstract=$(sed -ne ' 27 + /^Abstract:[ ]/{ 28 + s/^[^ ]*// 29 + x 30 + s/.*// 31 + x 32 + : again 33 + /^[ ]/{ 34 + s/^[ ]*// 35 + H 36 + n 37 + b again 38 + } 39 + x 40 + p 41 + q 42 + }' "$txt") 43 + 44 + if grep 'Content-type: text/asciidoc' >/dev/null $txt 45 + then 46 + file=$(expr "$txt" : '\(.*\)\.txt$').html 47 + else 48 + file="$txt" 49 + fi 50 + 51 + echo "* link:howto/$(basename "$file")[$title] $from 52 + $abstract 53 + 54 + " 55 + 56 + done