threads / patch / 1329

patchExtend git-ls-files --exclude option to match against directories

Subject: [PATCH] Extend git-ls-files --exclude option to match against directories

## tl;dr

One message between Jul 24, 2005 and Jul 24, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Marco Costalba· Jul 24, 2005, 08:12 UTC · lore

Pattern in git-ls-files --exclude=<pattern> can include directories as example git-ls-files --exclude=Documentation/* will do what you expect ---

 ls-files.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
c8fdfc1f8280a753baf13c293db573c4e50f0a99
Show changes to ls-files.c +1 −3
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -80,10 +80,8 @@ static int excluded(const char *pathname
 {
 	int i;
 	if (nr_excludes) {
-		const char *basename = strrchr(pathname, '/');
-		basename = (basename) ? basename+1 : pathname;
 		for (i = 0; i < nr_excludes; i++)
-			if (fnmatch(excludes[i], basename, 0) == 0)
+			if (fnmatch(excludes[i], pathname, FNM_PATHNAME) == 0)
 				return 1;
 	}
 	return 0;


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

← back to recent threads