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

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

From
MCMarco Costalba <mcostalba@yahoo.it>
Date
Jul 24, 2005, 08:12 UTC
Message-ID
<20050724081225.81671.qmail@web26304.mail.ukl.yahoo.com>

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
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 
Message 1 of 1 in “Extend git-ls-files --exclude option to match against directories”
  1. Extend git-ls-files --exclude option to match against directoriesMarco Costalba, Jul 24, 2005

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.