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

[PATCH v2 04/17] Remove common-cmds.h

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
May 20, 2018, 18:39 UTC
Message-ID
<20180520184009.976-5-pclouds@gmail.com>
In-Reply-To
<20180520184009.976-1-pclouds@gmail.com>

After the last patch, common-cmds.h is no longer used (and it was actually broken). Remove all related code. command-list.h will take its place from now on.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 .gitignore          |  1 -
 Makefile            | 17 ++++++-----------
 generate-cmdlist.sh | 46 +++------------------------------------------
 3 files changed, 9 insertions(+), 55 deletions(-)
diff --git a/.gitignore b/.gitignore
index d4c3914167..0836083992 100644
--- a/.gitignore
+++ b/.gitignore
@@ -179,7 +179,6 @@
 /gitweb/gitweb.cgi
 /gitweb/static/gitweb.js
 /gitweb/static/gitweb.min.*
-/common-cmds.h
 /command-list.h
 *.tar.gz
 *.dsc
diff --git a/Makefile b/Makefile
index 5c58b0b692..a60a78ee67 100644
--- a/Makefile
+++ b/Makefile
@@ -757,7 +757,7 @@ LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
 VCSSVN_LIB = vcs-svn/lib.a
 
-GENERATED_H += common-cmds.h command-list.h
+GENERATED_H += command-list.h
 
 LIB_H = $(shell $(FIND) . \
 	-name .git -prune -o \
@@ -1914,9 +1914,9 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
 		$(filter %.o,$^) $(LIBS)
 
-help.sp help.s help.o: common-cmds.h command-list.h
+help.sp help.s help.o: command-list.h
 
-builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h command-list.h GIT-PREFIX
+builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
 	'-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
 	'-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@ -1935,11 +1935,6 @@ $(BUILT_INS): git$X
 	ln -s $< $@ 2>/dev/null || \
 	cp $< $@
 
-common-cmds.h: generate-cmdlist.sh command-list.txt
-
-common-cmds.h: $(wildcard Documentation/git-*.txt)
-	$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt COMMON >$@+ && mv $@+ $@
-
 command-list.h: generate-cmdlist.sh command-list.txt
 
 command-list.h: $(wildcard Documentation/git-*.txt)
@@ -2153,7 +2148,7 @@ else
 # Dependencies on header files, for platforms that do not support
 # the gcc -MMD option.
 #
-# Dependencies on automatically generated headers such as common-cmds.h or command-list.h
+# Dependencies on automatically generated headers such as command-list.h
 # should _not_ be included here, since they are necessary even when
 # building an object for the first time.
 
@@ -2532,7 +2527,7 @@ sparse: $(SP_OBJ)
 style:
 	git clang-format --style file --diff --extensions c,h
 
-check: common-cmds.h command-list.h
+check: command-list.h
 	@if sparse; \
 	then \
 		echo >&2 "Use 'make sparse' instead"; \
@@ -2780,7 +2775,7 @@ clean: profile-clean coverage-clean
 	$(RM) $(TEST_PROGRAMS) $(NO_INSTALL)
 	$(RM) -r bin-wrappers $(dep_dirs)
 	$(RM) -r po/build/
-	$(RM) *.pyc *.pyo */*.pyc */*.pyo common-cmds.h command-list.h $(ETAGS_TARGET) tags cscope*
+	$(RM) *.pyc *.pyo */*.pyc */*.pyo command-list.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-cmdlist.sh b/generate-cmdlist.sh
index 9eb22c4ef1..3bcc1ee57d 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -68,46 +68,6 @@ struct cmdname_help {
 	uint32_t category;
 };
 "
-if test -z "$2"
-then
-	define_categories "$1"
-	echo
-	print_command_list "$1"
-	exit 0
-fi
-
-echo "static const char *common_cmd_groups[] = {"
-
-grps=grps$$.tmp
-match=match$$.tmp
-trap "rm -f '$grps' '$match'" 0 1 2 3 15
-
-sed -n '
-	1,/^### common groups/b
-	/^### command list/q
-	/^#/b
-	/^[ 	]*$/b
-	h;s/^[^ 	][^ 	]*[ 	][ 	]*\(.*\)/	N_("\1"),/p
-	g;s/^\([^ 	][^ 	]*\)[ 	].*/\1/w '$grps'
-	' "$1"
-printf '};\n\n'
-
-n=0
-substnum=
-while read grp
-do
-	echo "^git-..*[ 	]$grp"
-	substnum="$substnum${substnum:+;}s/[ 	]$grp/$n/"
-	n=$(($n+1))
-done <"$grps" >"$match"
-
-printf 'static struct cmdname_help common_cmds[] = {\n'
-grep -f "$match" "$1" |
-sed 's/^git-//' |
-sort |
-while read cmd tags
-do
-	tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
-	echo "	{\"$cmd\", $(get_synopsis git-$cmd), $tag},"
-done
-echo "};"
+define_categories "$1"
+echo
+print_command_list "$1"
-- 
2.17.0.705.g3525833791
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 39 of 40 in “nd/command-list updates”
  1. 00/14 nd/command-list updatesNguyễn Thái Ngọc Duy, May 19, 2018
  2. 01/14 generate-cmds.sh: factor out synopsis extract codeNguyễn Thái Ngọc Duy, May 19, 2018
  3. 02/14 generate-cmds.sh: export all commands to command-list.hNguyễn Thái Ngọc Duy, May 19, 2018
  4. 06/14 git --list-cmds: collect command list in a string_listNguyễn Thái Ngọc Duy, May 19, 2018
  5. 07/14 completion: implement and use --list-cmds=main,othersNguyễn Thái Ngọc Duy, May 19, 2018
  6. 09/14 help: add "-a --verbose" to list all commands with synopsisNguyễn Thái Ngọc Duy, May 19, 2018
  7. 08/14 git: support --list-cmds=list-<category>Nguyễn Thái Ngọc Duy, May 19, 2018
  8. 05/14 git.c: convert --list-* to --list-cmds=*Nguyễn Thái Ngọc Duy, May 19, 2018
  9. 04/14 Remove common-cmds.hNguyễn Thái Ngọc Duy, May 19, 2018
  10. 14/14 completion: allow to customize the completable command listNguyễn Thái Ngọc Duy, May 19, 2018
  11. SZEDER GáborMay 20, 2018
  12. Duy NguyenMay 20, 2018
  13. 13/14 completion: reduce completable command listNguyễn Thái Ngọc Duy, May 19, 2018
  14. SZEDER GáborMay 20, 2018
  15. Junio C HamanoMay 21, 2018
  16. 10/14 help: use command-list.txt for the source of guidesNguyễn Thái Ngọc Duy, May 19, 2018
  17. 03/14 help: use command-list.h for common command listNguyễn Thái Ngọc Duy, May 19, 2018
  18. 11/14 command-list.txt: documentation and guide lineNguyễn Thái Ngọc Duy, May 19, 2018
  19. 12/14 completion: let git provide the completable command listNguyễn Thái Ngọc Duy, May 19, 2018
  20. SZEDER GáborMay 20, 2018
  21. Duy NguyenMay 20, 2018
  22. 00/17 nd/command-list updatesNguyễn Thái Ngọc Duy, May 20, 2018
  23. 01/17 generate-cmds.sh: factor out synopsis extract codeNguyễn Thái Ngọc Duy, May 20, 2018
  24. 02/17 generate-cmds.sh: export all commands to command-list.hNguyễn Thái Ngọc Duy, May 20, 2018
  25. 03/17 help: use command-list.h for common command listNguyễn Thái Ngọc Duy, May 20, 2018
  26. 07/17 completion: implement and use --list-cmds=main,othersNguyễn Thái Ngọc Duy, May 20, 2018
  27. 06/17 git --list-cmds: collect command list in a string_listNguyễn Thái Ngọc Duy, May 20, 2018
  28. 08/17 git: support --list-cmds=list-<category>Nguyễn Thái Ngọc Duy, May 20, 2018
  29. 13/17 completion: reduce completable command listNguyễn Thái Ngọc Duy, May 20, 2018
  30. 14/17 Move declaration for alias.c to alias.hNguyễn Thái Ngọc Duy, May 20, 2018
  31. 15/17 completion: add and use --list-cmds=nohelpersNguyễn Thái Ngọc Duy, May 20, 2018
  32. 12/17 completion: let git provide the completable command listNguyễn Thái Ngọc Duy, May 20, 2018
  33. 11/17 command-list.txt: documentation and guide lineNguyễn Thái Ngọc Duy, May 20, 2018
  34. 10/17 help: use command-list.txt for the source of guidesNguyễn Thái Ngọc Duy, May 20, 2018
  35. Ævar Arnfjörð BjarmasonNov 20, 2018
  36. 17/17 completion: allow to customize the completable command listNguyễn Thái Ngọc Duy, May 20, 2018
  37. 16/17 completion: add and use --list-cmds=aliasNguyễn Thái Ngọc Duy, May 20, 2018
  38. 05/17 git.c: convert --list-* to --list-cmds=*Nguyễn Thái Ngọc Duy, May 20, 2018
  39. 04/17 Remove common-cmds.hNguyễn Thái Ngọc Duy, May 20, 2018
  40. 09/17 help: add "-a --verbose" to list all commands with synopsisNguyễn Thái Ngọc Duy, May 20, 2018

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.