{"thread":{"id":"30723","subject":"[PATCH 1/6] ls-files -i: pay attention to exclusion of leading paths","startedAt":"2012-06-06T05:45:13Z","lastAt":"2012-06-06T05:45:19Z","messageCount":7,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"192965","messageId":"1338961519-30970-1-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":null,"subject":"[PATCH 0/6] \"ls-files -i\" not honoring directory wide ignore","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:13Z","receivedAt":"2012-06-06T05:45:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"git ls-files --exclude=t -i\" does not list anything, even though it\nought to report all the paths that are tracked in the t/ directory.\n\nThis is because the command used excluded() API incorrectly. The API\nis designed to be called by callers that walk the tree structure\nfrom the top level, checking each and every level as it descends,\nand stop descending into a directory that is known to be ignored,\nbut the caller just passed a full path of a tracked file without\nchecking its higher level components and asked \"Is this ignored?\".\n\nThis series introduces a new path_excluded() API to be used for such\ncallers based on the excluded() API.  Also converted to use this new\nAPI are two other callers of the excluded(), namely \"git checkout\"\nand \"git add -n --ignore-missing\", that shared the same issue.\n\nThe third patch is more or less an \"Oops, the earlier one was not\nideal\" fix-up patch, but as the earlier parts of the series is\nalready in \"next\", I'll leave it as-is for now.  It probably is\nnecessary to squash it into the earlier patches post 1.7.11 after\nthe \"next\" branch is rewound.\n\nJunio C Hamano (6):\n  ls-files -i: pay attention to exclusion of leading paths\n  ls-files -i: micro-optimize path_excluded()\n  path_excluded(): update API to less cache-entry centric\n  builtin/add.c: use path_excluded()\n  unpack-trees.c: use path_excluded() in check_ok_to_remove()\n  dir.c: make excluded() file scope static\n\n builtin/add.c      |  6 +++++-\n builtin/ls-files.c | 23 +++++++++++++++------\n dir.c              | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-\n dir.h              | 18 +++++++++++++++-\n unpack-trees.c     | 11 +++++++++-\n unpack-trees.h     |  1 +\n 6 files changed, 109 insertions(+), 10 deletions(-)\n\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192961","messageId":"1338961519-30970-2-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 1/6] ls-files -i: pay attention to exclusion of leading paths","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:14Z","receivedAt":"2012-06-06T05:45:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"git ls-files --exclude=t/ -i\" does not show paths in directory t/\nthat have been added to the index, but it should.\n\nThe excluded() API was designed for callers who walk the tree from\nthe top, checking each level of the directory hierarchy as it\ndescends if it is excluded, and not even bothering to recurse into\nan excluded directory.  This would allow us optimize for a common\ncase by not having to check if the exclude pattern \"foo/\" matches\nwhen looking at \"foo/bar\", because the caller should have noticed\nthat \"foo\" is excluded and did not even bother to read \"foo/bar\"\nout of opendir()/readdir() to call it.\n\nThe code for \"ls-files -i\" however walks the index linearly, feeding\npaths without checking if the leading directory is already excluded.\n\nIntroduce a helper function path_excluded() to let this caller\nproperly call excluded() check for higher hierarchies as necessary.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/ls-files.c | 17 +++++++++++------\n dir.c              | 32 ++++++++++++++++++++++++++++++++\n dir.h              | 16 ++++++++++++++++\n 3 files changed, 59 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 7cff175..90dc360 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -203,6 +203,10 @@ static void show_ru_info(void)\n static void show_files(struct dir_struct *dir)\n {\n \tint i;\n+\tstruct path_exclude_check check;\n+\n+\tif ((dir->flags & DIR_SHOW_IGNORED))\n+\t\tpath_exclude_check_init(&check, dir);\n \n \t/* For cached/deleted files we don't need to even do the readdir */\n \tif (show_others || show_killed) {\n@@ -215,9 +219,8 @@ static void show_files(struct dir_struct *dir)\n \tif (show_cached | show_stage) {\n \t\tfor (i = 0; i < active_nr; i++) {\n \t\t\tstruct cache_entry *ce = active_cache[i];\n-\t\t\tint dtype = ce_to_dtype(ce);\n-\t\t\tif (dir->flags & DIR_SHOW_IGNORED &&\n-\t\t\t    !excluded(dir, ce->name, &dtype))\n+\t\t\tif ((dir->flags & DIR_SHOW_IGNORED) &&\n+\t\t\t    !path_excluded(&check, ce))\n \t\t\t\tcontinue;\n \t\t\tif (show_unmerged && !ce_stage(ce))\n \t\t\t\tcontinue;\n@@ -232,9 +235,8 @@ static void show_files(struct dir_struct *dir)\n \t\t\tstruct cache_entry *ce = active_cache[i];\n \t\t\tstruct stat st;\n \t\t\tint err;\n-\t\t\tint dtype = ce_to_dtype(ce);\n-\t\t\tif (dir->flags & DIR_SHOW_IGNORED &&\n-\t\t\t    !excluded(dir, ce->name, &dtype))\n+\t\t\tif ((dir->flags & DIR_SHOW_IGNORED) &&\n+\t\t\t    !path_excluded(&check, ce))\n \t\t\t\tcontinue;\n \t\t\tif (ce->ce_flags & CE_UPDATE)\n \t\t\t\tcontinue;\n@@ -247,6 +249,9 @@ static void show_files(struct dir_struct *dir)\n \t\t\t\tshow_ce_entry(tag_modified, ce);\n \t\t}\n \t}\n+\n+\tif ((dir->flags & DIR_SHOW_IGNORED))\n+\t\tpath_exclude_check_clear(&check);\n }\n \n /*\ndiff --git a/dir.c b/dir.c\nindex 0a78d00..c3f0884 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -580,6 +580,38 @@ int excluded(struct dir_struct *dir, const char *pathname, int *dtype_p)\n \treturn 0;\n }\n \n+void path_exclude_check_init(struct path_exclude_check *check,\n+\t\t\t     struct dir_struct *dir)\n+{\n+\tcheck->dir = dir;\n+\tstrbuf_init(&check->path, 256);\n+}\n+\n+void path_exclude_check_clear(struct path_exclude_check *check)\n+{\n+\tstrbuf_release(&check->path);\n+}\n+\n+int path_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n+{\n+\tint i, dtype;\n+\tstruct strbuf *path = &check->path;\n+\n+\tstrbuf_setlen(path, 0);\n+\tfor (i = 0; ce->name[i]; i++) {\n+\t\tint ch = ce->name[i];\n+\n+\t\tif (ch == '/') {\n+\t\t\tdtype = DT_DIR;\n+\t\t\tif (excluded(check->dir, path->buf, &dtype))\n+\t\t\t\treturn 1;\n+\t\t}\n+\t\tstrbuf_addch(path, ch);\n+\t}\n+\tdtype = ce_to_dtype(ce);\n+\treturn excluded(check->dir, ce->name, &dtype);\n+}\n+\n static struct dir_entry *dir_entry_new(const char *pathname, int len)\n {\n \tstruct dir_entry *ent;\ndiff --git a/dir.h b/dir.h\nindex dd6947e..7378e69 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -1,6 +1,8 @@\n #ifndef DIR_H\n #define DIR_H\n \n+#include \"strbuf.h\"\n+\n struct dir_entry {\n \tunsigned int len;\n \tchar name[FLEX_ARRAY]; /* more */\n@@ -78,6 +80,20 @@ extern int excluded_from_list(const char *pathname, int pathlen, const char *bas\n \t\t\t      int *dtype, struct exclude_list *el);\n extern int excluded(struct dir_struct *, const char *, int *);\n struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len);\n+\n+/*\n+ * The excluded() API is meant for callers that check each level of leading\n+ * directory hierarchies with excluded() to avoid recursing into excluded\n+ * directories.  Callers that do not do so should use this API instead.\n+ */\n+struct path_exclude_check {\n+\tstruct dir_struct *dir;\n+\tstruct strbuf path;\n+};\n+extern void path_exclude_check_init(struct path_exclude_check *, struct dir_struct *);\n+extern void path_exclude_check_clear(struct path_exclude_check *);\n+extern int path_excluded(struct path_exclude_check *, struct cache_entry *);\n+\n extern int add_excludes_from_file_to_list(const char *fname, const char *base, int baselen,\n \t\t\t\t\t  char **buf_p, struct exclude_list *which, int check_index);\n extern void add_excludes_from_file(struct dir_struct *, const char *fname);\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192962","messageId":"1338961519-30970-3-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/6] ls-files -i: micro-optimize path_excluded()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:15Z","receivedAt":"2012-06-06T05:45:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"As we know a caller that does not recurse is calling us in the index\norder, we can remember the last directory we found to be excluded\nand see if the path we are looking at is still inside it, in which\ncase we can just answer that it is excluded.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n dir.c | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/dir.c b/dir.c\nindex c3f0884..839bc9f 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -592,11 +592,25 @@ void path_exclude_check_clear(struct path_exclude_check *check)\n \tstrbuf_release(&check->path);\n }\n \n+/*\n+ * Is the ce->name excluded?  This is for a caller like show_files() that\n+ * do not honor directory hierarchy and iterate through paths that are\n+ * possibly in an ignored directory.\n+ *\n+ * A path to a directory known to be excluded is left in check->path to\n+ * optimize for repeated checks for files in the same excluded directory.\n+ */\n int path_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n {\n \tint i, dtype;\n \tstruct strbuf *path = &check->path;\n \n+\tif (path->len &&\n+\t    path->len <= ce_namelen(ce) &&\n+\t    !memcmp(ce->name, path->buf, path->len) &&\n+\t    (!ce->name[path->len] || ce->name[path->len] == '/'))\n+\t\treturn 1;\n+\n \tstrbuf_setlen(path, 0);\n \tfor (i = 0; ce->name[i]; i++) {\n \t\tint ch = ce->name[i];\n@@ -608,6 +622,10 @@ int path_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n \t\t}\n \t\tstrbuf_addch(path, ch);\n \t}\n+\n+\t/* An entry in the index; cannot be a directory with subentries */\n+\tstrbuf_setlen(path, 0);\n+\n \tdtype = ce_to_dtype(ce);\n \treturn excluded(check->dir, ce->name, &dtype);\n }\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192963","messageId":"1338961519-30970-4-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 3/6] path_excluded(): update API to less cache-entry centric","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:16Z","receivedAt":"2012-06-06T05:45:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It was stupid of me to make the API too much cache-entry specific;\nthe caller may want to check arbitrary pathname without having a\ncorresponding cache-entry to see if a path is ignored.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/ls-files.c | 10 ++++++++--\n dir.c              | 32 ++++++++++++++++++++------------\n dir.h              |  3 ++-\n 3 files changed, 30 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 90dc360..31b3f2d 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -200,6 +200,12 @@ static void show_ru_info(void)\n \t}\n }\n \n+static int ce_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n+{\n+\tint dtype = ce_to_dtype(ce);\n+\treturn path_excluded(check, ce->name, ce_namelen(ce), &dtype);\n+}\n+\n static void show_files(struct dir_struct *dir)\n {\n \tint i;\n@@ -220,7 +226,7 @@ static void show_files(struct dir_struct *dir)\n \t\tfor (i = 0; i < active_nr; i++) {\n \t\t\tstruct cache_entry *ce = active_cache[i];\n \t\t\tif ((dir->flags & DIR_SHOW_IGNORED) &&\n-\t\t\t    !path_excluded(&check, ce))\n+\t\t\t    !ce_excluded(&check, ce))\n \t\t\t\tcontinue;\n \t\t\tif (show_unmerged && !ce_stage(ce))\n \t\t\t\tcontinue;\n@@ -236,7 +242,7 @@ static void show_files(struct dir_struct *dir)\n \t\t\tstruct stat st;\n \t\t\tint err;\n \t\t\tif ((dir->flags & DIR_SHOW_IGNORED) &&\n-\t\t\t    !path_excluded(&check, ce))\n+\t\t\t    !ce_excluded(&check, ce))\n \t\t\t\tcontinue;\n \t\t\tif (ce->ce_flags & CE_UPDATE)\n \t\t\t\tcontinue;\ndiff --git a/dir.c b/dir.c\nindex 839bc9f..7ab7fc5 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -593,31 +593,40 @@ void path_exclude_check_clear(struct path_exclude_check *check)\n }\n \n /*\n- * Is the ce->name excluded?  This is for a caller like show_files() that\n+ * Is this name excluded?  This is for a caller like show_files() that\n  * do not honor directory hierarchy and iterate through paths that are\n  * possibly in an ignored directory.\n  *\n  * A path to a directory known to be excluded is left in check->path to\n  * optimize for repeated checks for files in the same excluded directory.\n  */\n-int path_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n+int path_excluded(struct path_exclude_check *check,\n+\t\t  const char *name, int namelen, int *dtype)\n {\n-\tint i, dtype;\n+\tint i;\n \tstruct strbuf *path = &check->path;\n \n+\t/*\n+\t * we allow the caller to pass namelen as an optimization; it\n+\t * must match the length of the name, as we eventually call\n+\t * excluded() on the whole name string.\n+\t */\n+\tif (namelen < 0)\n+\t\tnamelen = strlen(name);\n+\n \tif (path->len &&\n-\t    path->len <= ce_namelen(ce) &&\n-\t    !memcmp(ce->name, path->buf, path->len) &&\n-\t    (!ce->name[path->len] || ce->name[path->len] == '/'))\n+\t    path->len <= namelen &&\n+\t    !memcmp(name, path->buf, path->len) &&\n+\t    (!name[path->len] || name[path->len] == '/'))\n \t\treturn 1;\n \n \tstrbuf_setlen(path, 0);\n-\tfor (i = 0; ce->name[i]; i++) {\n-\t\tint ch = ce->name[i];\n+\tfor (i = 0; name[i]; i++) {\n+\t\tint ch = name[i];\n \n \t\tif (ch == '/') {\n-\t\t\tdtype = DT_DIR;\n-\t\t\tif (excluded(check->dir, path->buf, &dtype))\n+\t\t\tint dt = DT_DIR;\n+\t\t\tif (excluded(check->dir, path->buf, &dt))\n \t\t\t\treturn 1;\n \t\t}\n \t\tstrbuf_addch(path, ch);\n@@ -626,8 +635,7 @@ int path_excluded(struct path_exclude_check *check, struct cache_entry *ce)\n \t/* An entry in the index; cannot be a directory with subentries */\n \tstrbuf_setlen(path, 0);\n \n-\tdtype = ce_to_dtype(ce);\n-\treturn excluded(check->dir, ce->name, &dtype);\n+\treturn excluded(check->dir, name, dtype);\n }\n \n static struct dir_entry *dir_entry_new(const char *pathname, int len)\ndiff --git a/dir.h b/dir.h\nindex 7378e69..36a82b3 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -92,7 +92,8 @@ struct path_exclude_check {\n };\n extern void path_exclude_check_init(struct path_exclude_check *, struct dir_struct *);\n extern void path_exclude_check_clear(struct path_exclude_check *);\n-extern int path_excluded(struct path_exclude_check *, struct cache_entry *);\n+extern int path_excluded(struct path_exclude_check *, const char *, int namelen, int *dtype);\n+\n \n extern int add_excludes_from_file_to_list(const char *fname, const char *base, int baselen,\n \t\t\t\t\t  char **buf_p, struct exclude_list *which, int check_index);\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192964","messageId":"1338961519-30970-5-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 4/6] builtin/add.c: use path_excluded()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:17Z","receivedAt":"2012-06-06T05:45:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This only happens in --ignore-missing --dry-run codepath which\npresumably nobody should care, but is for completeness.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/add.c | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/add.c b/builtin/add.c\nindex c59b0c9..e5b40d9 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -441,6 +441,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \n \tif (pathspec) {\n \t\tint i;\n+\t\tstruct path_exclude_check check;\n+\n+\t\tpath_exclude_check_init(&check, &dir);\n \t\tif (!seen)\n \t\t\tseen = find_used_pathspec(pathspec);\n \t\tfor (i = 0; pathspec[i]; i++) {\n@@ -448,7 +451,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \t\t\t    && !file_exists(pathspec[i])) {\n \t\t\t\tif (ignore_missing) {\n \t\t\t\t\tint dtype = DT_UNKNOWN;\n-\t\t\t\t\tif (excluded(&dir, pathspec[i], &dtype))\n+\t\t\t\t\tif (path_excluded(&check, pathspec[i], -1, &dtype))\n \t\t\t\t\t\tdir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));\n \t\t\t\t} else\n \t\t\t\t\tdie(_(\"pathspec '%s' did not match any files\"),\n@@ -456,6 +459,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t}\n \t\tfree(seen);\n+\t\tpath_exclude_check_clear(&check);\n \t}\n \n \texit_status |= add_files_to_cache(prefix, pathspec, flags);\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192966","messageId":"1338961519-30970-6-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 5/6] unpack-trees.c: use path_excluded() in check_ok_to_remove()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:18Z","receivedAt":"2012-06-06T05:45:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This function is responsible for determining if a path that is not\ntracked is ignored and allow \"checkout\" to overwrite it as needed.\nIt used excluded() without checking if higher level directory in the\npath is ignored; correct it to use path_excluded() for this check.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * There are uses of lower-level interface excluded_from_list() in\n   the codepath for narrow-checkout hack; they are supposed to be\n   already checking each level as they descend, and are not touched\n   with this patch.\n---\n unpack-trees.c | 11 ++++++++++-\n unpack-trees.h |  1 +\n 2 files changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 7c9ecf6..133f2c9 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -1016,6 +1016,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options\n \t\t\to->el = &el;\n \t}\n \n+\tif (o->dir) {\n+\t\to->path_exclude_check = xmalloc(sizeof(struct path_exclude_check));\n+\t\tpath_exclude_check_init(o->path_exclude_check, o->dir);\n+\t}\n \tmemset(&o->result, 0, sizeof(o->result));\n \to->result.initialized = 1;\n \to->result.timestamp.sec = o->src_index->timestamp.sec;\n@@ -1140,6 +1144,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options\n \n done:\n \tfree_excludes(&el);\n+\tif (o->path_exclude_check) {\n+\t\tpath_exclude_check_clear(o->path_exclude_check);\n+\t\tfree(o->path_exclude_check);\n+\t}\n \treturn ret;\n \n return_failed:\n@@ -1355,7 +1363,8 @@ static int check_ok_to_remove(const char *name, int len, int dtype,\n \tif (ignore_case && icase_exists(o, name, len, st))\n \t\treturn 0;\n \n-\tif (o->dir && excluded(o->dir, name, &dtype))\n+\tif (o->dir &&\n+\t    path_excluded(o->path_exclude_check, name, -1, &dtype))\n \t\t/*\n \t\t * ce->name is explicitly excluded, so it is Ok to\n \t\t * overwrite it.\ndiff --git a/unpack-trees.h b/unpack-trees.h\nindex 5e432f5..ec74a9f 100644\n--- a/unpack-trees.h\n+++ b/unpack-trees.h\n@@ -52,6 +52,7 @@ struct unpack_trees_options {\n \tconst char *prefix;\n \tint cache_bottom;\n \tstruct dir_struct *dir;\n+\tstruct path_exclude_check *path_exclude_check;\n \tstruct pathspec *pathspec;\n \tmerge_fn_t fn;\n \tconst char *msgs[NB_UNPACK_TREES_ERROR_TYPES];\n-- \n1.7.11.rc1.37.g09843ac\n"},{"id":"192967","messageId":"1338961519-30970-7-git-send-email-gitster@pobox.com","threadId":"30723","inReplyTo":"1338961519-30970-1-git-send-email-gitster@pobox.com","subject":"[PATCH 6/6] dir.c: make excluded() file scope static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-06T05:45:19Z","receivedAt":"2012-06-06T05:45:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Now there no longer is external callers of this interface, so we can\nmake it static.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n dir.c | 2 +-\n dir.h | 1 -\n 2 files changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/dir.c b/dir.c\nindex 7ab7fc5..79e4337 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -560,7 +560,7 @@ int excluded_from_list(const char *pathname,\n \treturn -1; /* undecided */\n }\n \n-int excluded(struct dir_struct *dir, const char *pathname, int *dtype_p)\n+static int excluded(struct dir_struct *dir, const char *pathname, int *dtype_p)\n {\n \tint pathlen = strlen(pathname);\n \tint st;\ndiff --git a/dir.h b/dir.h\nindex 36a82b3..1a88a75 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -78,7 +78,6 @@ extern int read_directory(struct dir_struct *, const char *path, int len, const\n \n extern int excluded_from_list(const char *pathname, int pathlen, const char *basename,\n \t\t\t      int *dtype, struct exclude_list *el);\n-extern int excluded(struct dir_struct *, const char *, int *);\n struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname, int len);\n \n /*\n-- \n1.7.11.rc1.37.g09843ac\n"}]}