{"thread":{"id":"23409","subject":"[PATCH 1/5] wt-status: remove unused workdir_untracked field","startedAt":"2010-04-10T07:40:51Z","lastAt":"2010-04-11T10:35:10Z","messageCount":14,"participants":["Junio C Hamano","Jeff King","Eric Raymond","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"139129","messageId":"1270885256-31589-1-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"20100410040959.GA11977@coredump.intra.peff.net","subject":"[PATCH 0/5] \"status --ignored\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:51Z","receivedAt":"2010-04-10T07:40:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> If ignored files are not listed, that's another problem. Even more\n>> serious, actually.\n>\n> See above.\n>\n> It wouldn't be too hard to add them in, and would look something like\n> the patch below.\n\nAs I didn't see a patch, I did a rough outline just for fun.\n\nJunio C Hamano (5):\n      wt-status: remove unused workdir_untracked field\n      wt-status: plug memory leak while collecting untracked files\n      wt-status: collect ignored files\n      wt-status: rename and restructure status-print-untracked\n      status: --ignored option shows ignored files\n"},{"id":"139127","messageId":"1270885256-31589-2-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"[PATCH 1/5] wt-status: remove unused workdir_untracked field","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:52Z","receivedAt":"2010-04-10T07:40:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n wt-status.c |    1 -\n wt-status.h |    1 -\n 2 files changed, 0 insertions(+), 2 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 8ca59a2..db20b86 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -378,7 +378,6 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \t\t\tcontinue;\n \t\tif (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))\n \t\t\tcontinue;\n-\t\ts->workdir_untracked = 1;\n \t\tstring_list_insert(ent->name, &s->untracked);\n \t}\n }\ndiff --git a/wt-status.h b/wt-status.h\nindex 9120673..2c49f46 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -47,7 +47,6 @@ struct wt_status {\n \t/* These are computed during processing of the individual sections */\n \tint commitable;\n \tint workdir_dirty;\n-\tint workdir_untracked;\n \tconst char *index_file;\n \tFILE *fp;\n \tconst char *prefix;\n-- \n1.7.1.rc0.264.g94f6e\n"},{"id":"139128","messageId":"1270885256-31589-3-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/5] wt-status: plug memory leak while collecting untracked files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:53Z","receivedAt":"2010-04-10T07:40:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n wt-status.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex db20b86..c88159a 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -379,7 +379,10 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \t\tif (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))\n \t\t\tcontinue;\n \t\tstring_list_insert(ent->name, &s->untracked);\n+\t\tfree(ent);\n \t}\n+\n+\tfree(dir.entries);\n }\n \n void wt_status_collect(struct wt_status *s)\n-- \n1.7.1.rc0.264.g94f6e\n"},{"id":"139130","messageId":"1270885256-31589-4-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"[PATCH 3/5] wt-status: collect ignored files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:54Z","receivedAt":"2010-04-10T07:40:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n wt-status.c |   16 ++++++++++++++++\n wt-status.h |    2 ++\n 2 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex c88159a..f13c7da 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -42,6 +42,7 @@ void wt_status_prepare(struct wt_status *s)\n \ts->index_file = get_index_file();\n \ts->change.strdup_strings = 1;\n \ts->untracked.strdup_strings = 1;\n+\ts->ignored.strdup_strings = 1;\n }\n \n static void wt_status_print_unmerged_header(struct wt_status *s)\n@@ -382,6 +383,21 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \t\tfree(ent);\n \t}\n \n+\tif (s->show_ignored_files) {\n+\t\tdir.nr = 0;\n+\t\tdir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;\n+\t\tfill_directory(&dir, s->pathspec);\n+\t\tfor (i = 0; i < dir.nr; i++) {\n+\t\t\tstruct dir_entry *ent = dir.entries[i];\n+\t\t\tif (!cache_name_is_other(ent->name, ent->len))\n+\t\t\t\tcontinue;\n+\t\t\tif (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))\n+\t\t\t\tcontinue;\n+\t\t\tstring_list_insert(ent->name, &s->ignored);\n+\t\t\tfree(ent);\n+\t\t}\n+\t}\n+\n \tfree(dir.entries);\n }\n \ndiff --git a/wt-status.h b/wt-status.h\nindex 2c49f46..1093e65 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -41,6 +41,7 @@ struct wt_status {\n \tint use_color;\n \tint relative_paths;\n \tint submodule_summary;\n+\tint show_ignored_files;\n \tenum untracked_status_type show_untracked_files;\n \tchar color_palette[WT_STATUS_UNMERGED+1][COLOR_MAXLEN];\n \n@@ -52,6 +53,7 @@ struct wt_status {\n \tconst char *prefix;\n \tstruct string_list change;\n \tstruct string_list untracked;\n+\tstruct string_list ignored;\n };\n \n void wt_status_prepare(struct wt_status *s);\n-- \n1.7.1.rc0.264.g94f6e\n"},{"id":"139131","messageId":"1270885256-31589-5-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"[PATCH 4/5] wt-status: rename and restructure status-print-untracked","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:55Z","receivedAt":"2010-04-10T07:40:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I will be reusing this to show ignored stuff in the next patch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n wt-status.c |   22 ++++++++++++++--------\n 1 files changed, 14 insertions(+), 8 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex f13c7da..2c9a05d 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -97,13 +97,15 @@ static void wt_status_print_dirty_header(struct wt_status *s,\n \tcolor_fprintf_ln(s->fp, c, \"#\");\n }\n \n-static void wt_status_print_untracked_header(struct wt_status *s)\n+static void wt_status_print_other_header(struct wt_status *s,\n+\t\t\t\t\t const char *what,\n+\t\t\t\t\t const char *how)\n {\n \tconst char *c = color(WT_STATUS_HEADER, s);\n-\tcolor_fprintf_ln(s->fp, c, \"# Untracked files:\");\n+\tcolor_fprintf_ln(s->fp, c, \"# %s files:\", what);\n \tif (!advice_status_hints)\n \t\treturn;\n-\tcolor_fprintf_ln(s->fp, c, \"#   (use \\\"git add <file>...\\\" to include in what will be committed)\");\n+\tcolor_fprintf_ln(s->fp, c, \"#   (use \\\"git %s <file>...\\\" to include in what will be committed)\", how);\n \tcolor_fprintf_ln(s->fp, c, \"#\");\n }\n \n@@ -541,7 +543,10 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt\n \trun_command(&sm_summary);\n }\n \n-static void wt_status_print_untracked(struct wt_status *s)\n+static void wt_status_print_other(struct wt_status *s,\n+\t\t\t\t  struct string_list *l,\n+\t\t\t\t  const char *what,\n+\t\t\t\t  const char *how)\n {\n \tint i;\n \tstruct strbuf buf = STRBUF_INIT;\n@@ -549,10 +554,11 @@ static void wt_status_print_untracked(struct wt_status *s)\n \tif (!s->untracked.nr)\n \t\treturn;\n \n-\twt_status_print_untracked_header(s);\n-\tfor (i = 0; i < s->untracked.nr; i++) {\n+\twt_status_print_other_header(s, what, how);\n+\n+\tfor (i = 0; i < l->nr; i++) {\n \t\tstruct string_list_item *it;\n-\t\tit = &(s->untracked.items[i]);\n+\t\tit = &(l->items[i]);\n \t\tcolor_fprintf(s->fp, color(WT_STATUS_HEADER, s), \"#\\t\");\n \t\tcolor_fprintf_ln(s->fp, color(WT_STATUS_UNTRACKED, s), \"%s\",\n \t\t\t\t quote_path(it->string, strlen(it->string),\n@@ -641,7 +647,7 @@ void wt_status_print(struct wt_status *s)\n \t\twt_status_print_submodule_summary(s, 1);  /* unstaged */\n \t}\n \tif (s->show_untracked_files)\n-\t\twt_status_print_untracked(s);\n+\t\twt_status_print_other(s, &s->untracked, \"Untracked\", \"add\");\n \telse if (s->commitable)\n \t\t fprintf(s->fp, \"# Untracked files not listed (use -u option to show untracked files)\\n\");\n \n-- \n1.7.1.rc0.264.g94f6e\n"},{"id":"139132","messageId":"1270885256-31589-6-git-send-email-gitster@pobox.com","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"[PATCH 5/5] status: --ignored option shows ignored files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:40:56Z","receivedAt":"2010-04-10T07:40:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"There is no stronger reason behind the choice of \"!!\" than just I happened\nto have typed them.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/commit.c |    6 +++++-\n wt-status.c      |   22 +++++++++++++++-------\n 2 files changed, 20 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex c5ab683..761ca07 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -83,6 +83,7 @@ static enum {\n static char *cleanup_arg;\n \n static int use_editor = 1, initial_commit, in_merge, include_status = 1;\n+static int show_ignored_in_status;\n static const char *only_include_assumed;\n static struct strbuf message;\n \n@@ -1031,6 +1032,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \t\t  \"mode\",\n \t\t  \"show untracked files, optional modes: all, normal, no. (Default: all)\",\n \t\t  PARSE_OPT_OPTARG, NULL, (intptr_t)\"all\" },\n+\t\tOPT_BOOLEAN(0, \"ignored\", &show_ignored_in_status,\n+\t\t\t    \"show ignored files\"),\n \t\tOPT_END(),\n \t};\n \n@@ -1044,7 +1047,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \t\t\t     builtin_status_options,\n \t\t\t     builtin_status_usage, 0);\n \thandle_untracked_files_arg(&s);\n-\n+\tif (show_ignored_in_status)\n+\t\ts.show_ignored_files = 1;\n \tif (*argv)\n \t\ts.pathspec = get_pathspec(prefix, argv);\n \ndiff --git a/wt-status.c b/wt-status.c\nindex 2c9a05d..7bda995 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -646,9 +646,11 @@ void wt_status_print(struct wt_status *s)\n \t\twt_status_print_submodule_summary(s, 0);  /* staged */\n \t\twt_status_print_submodule_summary(s, 1);  /* unstaged */\n \t}\n-\tif (s->show_untracked_files)\n+\tif (s->show_untracked_files) {\n \t\twt_status_print_other(s, &s->untracked, \"Untracked\", \"add\");\n-\telse if (s->commitable)\n+\t\tif (s->show_ignored_files)\n+\t\t\twt_status_print_other(s, &s->ignored, \"Ignored\", \"add -f\");\n+\t} else if (s->commitable)\n \t\t fprintf(s->fp, \"# Untracked files not listed (use -u option to show untracked files)\\n\");\n \n \tif (s->verbose)\n@@ -730,16 +732,16 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item\n \t}\n }\n \n-static void wt_shortstatus_untracked(int null_termination, struct string_list_item *it,\n-\t\t\t    struct wt_status *s)\n+static void wt_shortstatus_other(int null_termination, struct string_list_item *it,\n+\t\t\t\t struct wt_status *s, const char *sign)\n {\n \tif (null_termination) {\n-\t\tfprintf(stdout, \"?? %s%c\", it->string, 0);\n+\t\tfprintf(stdout, \"%s %s%c\", sign, it->string, 0);\n \t} else {\n \t\tstruct strbuf onebuf = STRBUF_INIT;\n \t\tconst char *one;\n \t\tone = quote_path(it->string, -1, &onebuf, s->prefix);\n-\t\tcolor_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), \"??\");\n+\t\tcolor_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), sign);\n \t\tprintf(\" %s\\n\", one);\n \t\tstrbuf_release(&onebuf);\n \t}\n@@ -763,7 +765,13 @@ void wt_shortstatus_print(struct wt_status *s, int null_termination)\n \t\tstruct string_list_item *it;\n \n \t\tit = &(s->untracked.items[i]);\n-\t\twt_shortstatus_untracked(null_termination, it, s);\n+\t\twt_shortstatus_other(null_termination, it, s, \"??\");\n+\t}\n+\tfor (i = 0; i < s->ignored.nr; i++) {\n+\t\tstruct string_list_item *it;\n+\n+\t\tit = &(s->ignored.items[i]);\n+\t\twt_shortstatus_other(null_termination, it, s, \"!!\");\n \t}\n }\n \n-- \n1.7.1.rc0.264.g94f6e\n"},{"id":"139133","messageId":"20100410074430.GA12567@coredump.intra.peff.net","threadId":"23409","inReplyTo":"1270885256-31589-1-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-10T07:44:30Z","receivedAt":"2010-04-10T07:44:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 10, 2010 at 12:40:51AM -0700, Junio C Hamano wrote:\n\n> > It wouldn't be too hard to add them in, and would look something like\n> > the patch below.\n> \n> As I didn't see a patch, I did a rough outline just for fun.\n\nGah. Yours is undoubtedly less ugly, but here was mine for reference.\n\ndiff --git a/dir.c b/dir.c\nindex cb83332..deee7c8 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -619,7 +619,9 @@ static int exclude_matches_pathspec(const char *path, int len,\n \t\t\t\treturn 1;\n \t\t}\n \t}\n-\treturn 0;\n+\t/* ugh, I think this may be a long-standing bug, but\n+\t * this code was never reachable before. */\n+\treturn 1;\n }\n \n static int get_index_dtype(const char *path, int len)\ndiff --git a/wt-status.c b/wt-status.c\nindex 8ca59a2..53a7a5a 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -366,6 +366,8 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \tif (!s->show_untracked_files)\n \t\treturn;\n \tmemset(&dir, 0, sizeof(dir));\n+\t/* should be conditional on s->show_ignored_files */\n+\tdir.flags |= DIR_COLLECT_IGNORED;\n \tif (s->show_untracked_files != SHOW_ALL_UNTRACKED_FILES)\n \t\tdir.flags |=\n \t\t\tDIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;\n@@ -381,6 +383,14 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \t\ts->workdir_untracked = 1;\n \t\tstring_list_insert(ent->name, &s->untracked);\n \t}\n+\tfor (i = 0; i < dir.ignored_nr; i++) {\n+\t\tstruct dir_entry *ent = dir.ignored[i];\n+\t\tif (!cache_name_is_other(ent->name, ent->len))\n+\t\t\tcontinue;\n+\t\tif (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))\n+\t\t\tcontinue;\n+\t\tstring_list_insert(ent->name, &s->ignored);\n+\t}\n }\n \n void wt_status_collect(struct wt_status *s)\n@@ -707,15 +717,15 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item\n }\n \n static void wt_shortstatus_untracked(int null_termination, struct string_list_item *it,\n-\t\t\t    struct wt_status *s)\n+\t\t\t    struct wt_status *s, const char *marker)\n {\n \tif (null_termination) {\n-\t\tfprintf(stdout, \"?? %s%c\", it->string, 0);\n+\t\tfprintf(stdout, \"%s %s%c\", marker, it->string, 0);\n \t} else {\n \t\tstruct strbuf onebuf = STRBUF_INIT;\n \t\tconst char *one;\n \t\tone = quote_path(it->string, -1, &onebuf, s->prefix);\n-\t\tcolor_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), \"??\");\n+\t\tcolor_fprintf(s->fp, color(WT_STATUS_UNTRACKED, s), marker);\n \t\tprintf(\" %s\\n\", one);\n \t\tstrbuf_release(&onebuf);\n \t}\n@@ -739,7 +749,11 @@ void wt_shortstatus_print(struct wt_status *s, int null_termination)\n \t\tstruct string_list_item *it;\n \n \t\tit = &(s->untracked.items[i]);\n-\t\twt_shortstatus_untracked(null_termination, it, s);\n+\t\twt_shortstatus_untracked(null_termination, it, s, \"??\");\n+\t}\n+\tfor (i = 0; i < s->ignored.nr; i++) {\n+\t\tstruct string_list_item *it = &(s->ignored.items[i]);\n+\t\twt_shortstatus_untracked(null_termination, it, s, \"II\");\n \t}\n }\n \ndiff --git a/wt-status.h b/wt-status.h\nindex 9120673..0f5cf38 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -53,6 +53,7 @@ struct wt_status {\n \tconst char *prefix;\n \tstruct string_list change;\n \tstruct string_list untracked;\n+\tstruct string_list ignored;\n };\n \n void wt_status_prepare(struct wt_status *s);\n"},{"id":"139134","messageId":"20100410074814.GB12567@coredump.intra.peff.net","threadId":"23409","inReplyTo":"1270885256-31589-4-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 3/5] wt-status: collect ignored files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-10T07:48:14Z","receivedAt":"2010-04-10T07:48:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 10, 2010 at 12:40:54AM -0700, Junio C Hamano wrote:\n\n> +\tif (s->show_ignored_files) {\n> +\t\tdir.nr = 0;\n> +\t\tdir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;\n> +\t\tfill_directory(&dir, s->pathspec);\n> +\t\tfor (i = 0; i < dir.nr; i++) {\n> +\t\t\tstruct dir_entry *ent = dir.entries[i];\n> +\t\t\tif (!cache_name_is_other(ent->name, ent->len))\n> +\t\t\t\tcontinue;\n> +\t\t\tif (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))\n> +\t\t\t\tcontinue;\n> +\t\t\tstring_list_insert(ent->name, &s->ignored);\n> +\t\t\tfree(ent);\n> +\t\t}\n> +\t}\n> +\n\nWhy not use DIR_COLLECT_IGNORED, which would mean we only have to\ntraverse the directory tree once?\n\n-Peff\n"},{"id":"139135","messageId":"7vd3y7ycgu.fsf@alter.siamese.dyndns.org","threadId":"23409","inReplyTo":"20100410074430.GA12567@coredump.intra.peff.net","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T07:48:49Z","receivedAt":"2010-04-10T07:48:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> +\tdir.flags |= DIR_COLLECT_IGNORED;\n\nI thought about using collect-ignored so that fill_directory() does not\nhave to be run twice, but IIRC it can short-circuit an entire directory\nusing the \"simplify\" logic (as it was designed to be used for \"git add\"),\nno?\n\nMine is not \"less ugly\", but just \"simple and stupid\" ;-).\n"},{"id":"139138","messageId":"20100410084007.GA16843@coredump.intra.peff.net","threadId":"23409","inReplyTo":"7vd3y7ycgu.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-10T08:40:07Z","receivedAt":"2010-04-10T08:40:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 10, 2010 at 12:48:49AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > +\tdir.flags |= DIR_COLLECT_IGNORED;\n> \n> I thought about using collect-ignored so that fill_directory() does not\n> have to be run twice, but IIRC it can short-circuit an entire directory\n> using the \"simplify\" logic (as it was designed to be used for \"git add\"),\n> no?\n\nHmm.  I didn't consider that. It may be sufficient to say \"foo/ is\nignored\" and let callers decide for themselves that \"foo/bar\" is\nignored, too (unless, of course, it appears as tracked earlier in the\nlist).\n\nI just worry that your version will perform less well. I'm not that\nworried about the double traversal (on any reasonable system everything\nwill be cached after the first traversal). But finding every file means\nwe have to traverse areas that git otherwise wouldn't look at, which\nmight mean going to disk to pull in all of the \"foo/\" directory\nstructure (which is less likely to be cached, since the rest of git\nisn't touching it), even though it may not even be of interest to us.\n\n-Peff\n"},{"id":"139154","messageId":"20100410144149.GA23959@thyrsus.com","threadId":"23409","inReplyTo":"20100410084007.GA16843@coredump.intra.peff.net","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Eric Raymond","fromEmail":"esr@thyrsus.com","sentAt":"2010-04-10T14:41:49Z","receivedAt":"2010-04-10T14:41:49Z","isPatch":true,"sender":{"key":"esr@thyrsus.com","avatar":"https://avatars.githubusercontent.com/u/727961?v=4"},"body":"Jeff King <peff@peff.net>:\n> On Sat, Apr 10, 2010 at 12:48:49AM -0700, Junio C Hamano wrote:\n> \n> > Jeff King <peff@peff.net> writes:\n> > \n> > > +\tdir.flags |= DIR_COLLECT_IGNORED;\n> > \n> > I thought about using collect-ignored so that fill_directory() does not\n> > have to be run twice, but IIRC it can short-circuit an entire directory\n> > using the \"simplify\" logic (as it was designed to be used for \"git add\"),\n> > no?\n> \n> Hmm.  I didn't consider that. It may be sufficient to say \"foo/ is\n> ignored\" and let callers decide for themselves that \"foo/bar\" is\n> ignored, too (unless, of course, it appears as tracked earlier in the\n> list).\n\nSpeaking as  a front-end author, I would prefer that all ignored paths \nbe listed so I don't have to do globbing.\n-- \n\t\t<a href=\"http://www.catb.org/~esr/\">Eric S. Raymond</a>\n"},{"id":"139176","messageId":"7v633zxiw4.fsf@alter.siamese.dyndns.org","threadId":"23409","inReplyTo":"20100410084007.GA16843@coredump.intra.peff.net","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-10T18:27:39Z","receivedAt":"2010-04-10T18:27:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> ... But finding every file means\n> we have to traverse areas that git otherwise wouldn't look at, which\n> might mean going to disk to pull in all of the \"foo/\" directory\n> structure (which is less likely to be cached, since the rest of git\n> isn't touching it), even though it may not even be of interest to us.\n\nYes, that is why it is adequate for us use COLLECT_IGNORED in \"git add\"\nand give \"foo/ is outside---you as an intelligent human should be able to\ninfer that your foo/bar is also\" without double traversal.\n\nEric's tool might want the same abbreviated information if it is just\nrelaying our output to an intelligent human.  Or it might want to get all\npaths if it wants to operate on them itself.  Knowing VC I chose to\nillustrate how to do the latter, but in the real implementation, we may\nwant --show-ignored=normal vs --show-ignored=expanded to support both\nuses.\n"},{"id":"139184","messageId":"m3fx33glob.fsf@localhost.localdomain","threadId":"23409","inReplyTo":"7v633zxiw4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-04-10T19:20:42Z","receivedAt":"2010-04-10T19:20:42Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > ... But finding every file means\n> > we have to traverse areas that git otherwise wouldn't look at, which\n> > might mean going to disk to pull in all of the \"foo/\" directory\n> > structure (which is less likely to be cached, since the rest of git\n> > isn't touching it), even though it may not even be of interest to us.\n> \n> Yes, that is why it is adequate for us use COLLECT_IGNORED in \"git add\"\n> and give \"foo/ is outside---you as an intelligent human should be able to\n> infer that your foo/bar is also\" without double traversal.\n> \n> Eric's tool might want the same abbreviated information if it is just\n> relaying our output to an intelligent human.  Or it might want to get all\n> paths if it wants to operate on them itself.  Knowing VC I chose to\n> illustrate how to do the latter, but in the real implementation, we may\n> want --show-ignored=normal vs --show-ignored=expanded to support both\n> uses.\n\nOr rather -i / --ignored-files[=(no|normal|all)], default to 'normal' \nin the '--ignored-files' form (without optional <mode>), similarly\nto currently existing -u / --untracked-files option to git-status.\n\nLet's not introduce yet another CLI inconsistency^TM in Git... ;-)\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"139241","messageId":"20100411103510.GD20484@coredump.intra.peff.net","threadId":"23409","inReplyTo":"7v633zxiw4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] \"status --ignored\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-11T10:35:10Z","receivedAt":"2010-04-11T10:35:10Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Apr 10, 2010 at 11:27:39AM -0700, Junio C Hamano wrote:\n\n> > ... But finding every file means\n> > we have to traverse areas that git otherwise wouldn't look at, which\n> > might mean going to disk to pull in all of the \"foo/\" directory\n> > structure (which is less likely to be cached, since the rest of git\n> > isn't touching it), even though it may not even be of interest to us.\n> \n> Yes, that is why it is adequate for us use COLLECT_IGNORED in \"git add\"\n> and give \"foo/ is outside---you as an intelligent human should be able to\n> infer that your foo/bar is also\" without double traversal.\n\nIt would be adequate here, too, if we want to know whether a specific\nfile is ignored. It just takes more work from the caller. But Eric has\nalready said he would prefer to just get all files, so let's go with\nwhat you wrote.\n\nIf another caller wants a more restricted but efficient interface later,\nwe can add it as you suggest (or more likely, they want to check a\nparticular _set_ of files, so we don't want to do a full traversal\nanyway. We would want to get their list of candidates and traverse just\nenough of the .gitignore stack to get answers for their set).\n\n-Peff\n"}]}