git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH 1/5] glossary.h: generate a glossary list from the Makefile

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Dec 8, 2014, 15:38 UTC
Message-ID
<dbf54a1a9697cab11692a40a3f7eba1e86508e44.1418052470.git.git@drmicha.warpmail.net>
In-Reply-To
<cover.1418052470.git.git@drmicha.warpmail.net>

Generate a header file which lists all terms defined in the glossary in a way suitable for localisation. This will be used by the new glossary command.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
I also snuck in a change to the clean target, so that we don't have to update
it (its definition) as long as we keep GENERATED_H up to date.
 .gitignore           | 1 +
 Makefile             | 7 +++++--
 generate-glossary.sh | 8 ++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100755 generate-glossary.sh
diff --git a/.gitignore b/.gitignore
index a052419..fb4ebaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -208,6 +208,7 @@
 /test-urlmatch-normalization
 /test-wildmatch
 /common-cmds.h
+/glossary.h
 *.tar.gz
 *.dsc
 *.deb
diff --git a/Makefile b/Makefile
index 14d5ac1..ae74fdf 100644
--- a/Makefile
+++ b/Makefile
@@ -627,7 +627,7 @@ LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
 VCSSVN_LIB = vcs-svn/lib.a
 
-GENERATED_H += common-cmds.h
+GENERATED_H += common-cmds.h glossary.h
 
 LIB_H = $(shell $(FIND) . \
 	-name .git -prune -o \
@@ -1649,6 +1649,9 @@ common-cmds.h: ./generate-cmdlist.sh command-list.txt
 common-cmds.h: $(wildcard Documentation/git-*.txt)
 	$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
 
+glossary.h: ./generate-glossary.sh Documentation/glossary-content.txt
+	$(QUIET_GEN)./generate-glossary.sh > $@+ && mv $@+ $@
+
 SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
 	$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 	$(gitwebdir_SQ):$(PERL_PATH_SQ)
@@ -2356,7 +2359,7 @@ clean: profile-clean coverage-clean
 	$(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
 	$(RM) -r bin-wrappers $(dep_dirs)
 	$(RM) -r po/build/
-	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
+	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
 	$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
 	$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
diff --git a/generate-glossary.sh b/generate-glossary.sh
new file mode 100755
index 0000000..41f1eb3
--- /dev/null
+++ b/generate-glossary.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+echo "/* Automatically generated by $0 */
+
+static const char *glossary[] = {"
+
+sed -n -e 's/^.*\]\]\(.*\)::$/\tN_("\1"),/p' Documentation/glossary-content.txt
+echo "};"
-- 
2.2.0.345.g7041aac
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 11 in “git-glossary”
  1. 0/5 git-glossaryMichael J Gruber, Dec 8, 2014
  2. 1/5 glossary.h: generate a glossary list from the MakefileMichael J Gruber, Dec 8, 2014
  3. 2/5 glossary: introduce glossary lookup commandMichael J Gruber, Dec 8, 2014
  4. Junio C HamanoDec 10, 2014
  5. Michael J GruberDec 11, 2014
  6. Junio C HamanoDec 11, 2014
  7. 3/5 glossary: man pageMichael J Gruber, Dec 8, 2014
  8. 4/5 l10n: git-glossaryMichael J Gruber, Dec 8, 2014
  9. Michael J GruberDec 8, 2014
  10. Christian CouderDec 8, 2014
  11. Michael J GruberDec 8, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.