Skip to content

Commit e6fc85b

Browse files
peffgitster
authored andcommitted
Makefile: exclude test cruft from FIND_SOURCE_FILES
The test directory may contain three types of files that match our patterns: 1. Helper programs in t/helper. 2. Sample data files (e.g., t/t4051/hello.c). 3. Untracked cruft in trash directories and t/perf/build. We want to match (1), but not the other two, as they just clutter up the list. For the ls-files method, we can drop (2) with a negative pathspec. We do not have to care about (3), since ls-files will not list untracked files. For `find`, we can match both cases with `-prune` patterns. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e951ebc commit e6fc85b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2150,9 +2150,15 @@ po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
21502150
$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
21512151

21522152
FIND_SOURCE_FILES = ( \
2153-
git ls-files '*.[hcS]' 2>/dev/null || \
2153+
git ls-files \
2154+
'*.[hcS]' \
2155+
':!*[tp][0-9][0-9][0-9][0-9]*' \
2156+
2>/dev/null || \
21542157
$(FIND) . \
21552158
\( -name .git -type d -prune \) \
2159+
-o \( -name '[tp][0-9][0-9][0-9][0-9]' -type d -prune \) \
2160+
-o \( -name build -type d -prune \) \
2161+
-o \( -name 'trash*' -type d -prune \) \
21562162
-o \( -name '*.[hcS]' -type f -print \) \
21572163
)
21582164

0 commit comments

Comments
 (0)