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

[PATCH 3/4] Makefile: match shell scripts in FIND_SOURCE_FILES

From
Jeff King <peff@peff.net>
Date
Dec 14, 2016, 14:29 UTC
Message-ID
<20161214142944.xqwkk2zjeyqk3gfr@sigill.intra.peff.net>
In-Reply-To
<20161214142533.svktxk63eiwaaeor@sigill.intra.peff.net>

We feed FIND_SOURCE_FILES to ctags to help developers navigate to particular functions, but we only feed C source code. The same feature can be helpful when working with shell scripts (especially the test suite). Modern versions of ctags know how to parse shell scripts; we just need to feed the filenames to it.

This patch specifically avoids including the individual test scripts themselves. Those are unlikely to be of interest, and there are a lot of them to process. It does pick up test-lib.sh and test-lib-functions.sh.

Note that our negative pathspec already excludes the individual scripts for the ls-files case, but we need to loosen the `find` rule to match it.

Signed-off-by: Jeff King <peff@peff.net>
---
Maybe people would find this annoying. It does increase the number of
entries in the tags file. I've been running something like it for a few
months and have found it useful.

It's also possible that some people have a version of ctags or etags that doesn't handle shell scripts. I imagine few enough people actually run "make tags" in the first place that we can probably try it and see.

 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 001126931..ef8de4a75 100644
--- a/Makefile
+++ b/Makefile
@@ -2152,14 +2152,16 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
 FIND_SOURCE_FILES = ( \
 	git ls-files \
 		'*.[hcS]' \
+		'*.sh' \
 		':!*[tp][0-9][0-9][0-9][0-9]*' \
 		2>/dev/null || \
 	$(FIND) . \
 		\( -name .git -type d -prune \) \
-		-o \( -name '[tp][0-9][0-9][0-9][0-9]' -type d -prune \) \
+		-o \( -name '[tp][0-9][0-9][0-9][0-9]*' -prune \) \
 		-o \( -name build -type d -prune \) \
 		-o \( -name 'trash*' -type d -prune \) \
 		-o \( -name '*.[hcS]' -type f -print \) \
+		-o \( -name '*.sh' -type f -print \) \
 	)
 
 $(ETAGS_TARGET): FORCE
-- 
2.11.0.341.g202cd3142
Previous: Jeff KingNext: Jeff King
Message 4 of 5 in “"make tags" improvements”
  1. 0/4 "make tags" improvementsJeff King, Dec 14, 2016
  2. 1/4 Makefile: reformat FIND_SOURCE_FILESJeff King, Dec 14, 2016
  3. 2/4 Makefile: exclude test cruft from FIND_SOURCE_FILESJeff King, Dec 14, 2016
  4. 3/4 Makefile: match shell scripts in FIND_SOURCE_FILESJeff King, Dec 14, 2016
  5. 4/4 Makefile: exclude contrib from FIND_SOURCE_FILESJeff King, Dec 14, 2016

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.