All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Chris Packham <judge.packham@gmail.com>
Subject: [PATCH 3/4] Makefile: match shell scripts in FIND_SOURCE_FILES
Date: Wed, 14 Dec 2016 09:29:44 -0500	[thread overview]
Message-ID: <20161214142944.xqwkk2zjeyqk3gfr@sigill.intra.peff.net> (raw)
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


  parent reply	other threads:[~2016-12-14 14:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 14:25 [PATCH 0/4] "make tags" improvements Jeff King
2016-12-14 14:26 ` [PATCH 1/4] Makefile: reformat FIND_SOURCE_FILES Jeff King
2016-12-14 14:28 ` [PATCH 2/4] Makefile: exclude test cruft from FIND_SOURCE_FILES Jeff King
2016-12-14 14:29 ` Jeff King [this message]
2016-12-14 14:32 ` [PATCH 4/4] Makefile: exclude contrib " Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161214142944.xqwkk2zjeyqk3gfr@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=judge.packham@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.