{"thread":{"id":"8271","subject":"[PATCH] git-status: respect core.excludesFile","startedAt":"2007-05-21T21:51:50Z","lastAt":"2007-05-22T00:12:17Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"42929","messageId":"Pine.LNX.4.64.0705212251300.6410@racer.site","threadId":"8271","inReplyTo":null,"subject":"[PATCH] git-status: respect core.excludesFile","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-21T21:51:50Z","receivedAt":"2007-05-21T21:51:50Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\ngit-add reads this variable, and honours the contents of that file if that\nexists. Match this behaviour in git-status, too.\n\nNoticed by Evan Carroll on IRC.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n wt-status.c |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex a055990..4bfe8f1 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -22,6 +22,7 @@ static const char use_add_rm_msg[] =\n \"use \\\"git add/rm <file>...\\\" to update what will be committed\";\n static const char use_add_to_include_msg[] =\n \"use \\\"git add <file>...\\\" to include in what will be committed\";\n+static const char *excludes_file;\n \n static int parse_status_slot(const char *var, int offset)\n {\n@@ -259,6 +260,8 @@ static void wt_status_print_untracked(struct wt_status *s)\n \tx = git_path(\"info/exclude\");\n \tif (file_exists(x))\n \t\tadd_excludes_from_file(&dir, x);\n+\tif (excludes_file && file_exists(excludes_file))\n+\t\tadd_excludes_from_file(&dir, excludes_file);\n \n \tread_directory(&dir, \".\", \"\", 0, NULL);\n \tfor(i = 0; i < dir.nr; i++) {\n@@ -356,5 +359,11 @@ int git_status_config(const char *k, const char *v)\n \t\tint slot = parse_status_slot(k, 13);\n \t\tcolor_parse(v, k, wt_status_colors[slot]);\n \t}\n+\tif (!strcmp(k, \"core.excludesfile\")) {\n+\t\tif (!v)\n+\t\t\tdie(\"core.excludesfile without value\");\n+\t\texcludes_file = xstrdup(v);\n+\t\treturn 0;\n+\t}\n \treturn git_default_config(k, v);\n }\n-- \n1.5.2.GIT\n"},{"id":"42934","messageId":"7v3b1pdbjf.fsf@assigned-by-dhcp.cox.net","threadId":"8271","inReplyTo":"Pine.LNX.4.64.0705212251300.6410@racer.site","subject":"Re: [PATCH] git-status: respect core.excludesFile","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-21T23:03:48Z","receivedAt":"2007-05-21T23:03:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> git-add reads this variable, and honours the contents of that file if that\n> exists. Match this behaviour in git-status, too.\n>\n> Noticed by Evan Carroll on IRC.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nSounds good, and probably is a 'maint' material.\n\nDon't we need a documentation update and additional test for it,\nthough?\n"},{"id":"42939","messageId":"Pine.LNX.4.64.0705220110401.6410@racer.site","threadId":"8271","inReplyTo":"7v3b1pdbjf.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] git-status: respect core.excludesFile","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-22T00:12:17Z","receivedAt":"2007-05-22T00:12:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\ngit-add reads this variable, and honours the contents of that file if that\nexists. Match this behaviour in git-status, too.\n\nNoticed by Evan Carroll on IRC.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Mon, 21 May 2007, Junio C Hamano wrote:\n\t\n\t> Sounds good, and probably is a 'maint' material.\n\t> \n\t> Don't we need a documentation update and additional test for it,\n\t> though?\n\n\tHere you are.\n\n Documentation/config.txt           |    5 +++++\n Documentation/git-status.txt       |    5 +++++\n t/t3001-ls-files-others-exclude.sh |   20 ++++++++++++++++++++\n wt-status.c                        |    9 +++++++++\n 4 files changed, 39 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ee1c35e..179cb17 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -256,6 +256,11 @@ You probably do not need to adjust this value.\n +\n Common unit suffixes of 'k', 'm', or 'g' are supported.\n \n+core.excludeFile::\n+\tIn addition to '.gitignore' (per-directory) and\n+\t'.git/info/exclude', git looks into this file for patterns\n+\tof files which are not meant to be tracked.\n+\n alias.*::\n \tCommand aliases for the gitlink:git[1] command wrapper - e.g.\n \tafter defining \"alias.last = cat-file commit HEAD\", the invocation\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex e9e193f..d701538 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -42,6 +42,11 @@ mean the same thing and the latter is kept for backward\n compatibility) and `color.status.<slot>` configuration variables\n to colorize its output.\n \n+As for gitlink:git-add[1], the configuration variable\n+'core.excludesfile' can indicate a path to a file containing patterns\n+of file names to exclude, in addition to patterns given in\n+'info/exclude' and '.gitignore'.\n+\n \n Author\n ------\ndiff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh\nindex db7a847..fcfcfbb 100755\n--- a/t/t3001-ls-files-others-exclude.sh\n+++ b/t/t3001-ls-files-others-exclude.sh\n@@ -79,4 +79,24 @@ test_expect_success \\\n        >output &&\n      git diff expect output'\n \n+cat > excludes-file << EOF\n+*.[1-8]\n+e*\n+EOF\n+\n+git-config core.excludesFile excludes-file\n+\n+git-runstatus | grep \"^#\t\" > output\n+\n+cat > expect << EOF\n+#\t.gitignore\n+#\ta.6\n+#\tone/\n+#\toutput\n+#\tthree/\n+EOF\n+\n+test_expect_success 'git-status honours core.excludesfile' \\\n+\t'diff -u expect output'\n+\n test_done\ndiff --git a/wt-status.c b/wt-status.c\nindex a055990..4bfe8f1 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -22,6 +22,7 @@ static const char use_add_rm_msg[] =\n \"use \\\"git add/rm <file>...\\\" to update what will be committed\";\n static const char use_add_to_include_msg[] =\n \"use \\\"git add <file>...\\\" to include in what will be committed\";\n+static const char *excludes_file;\n \n static int parse_status_slot(const char *var, int offset)\n {\n@@ -259,6 +260,8 @@ static void wt_status_print_untracked(struct wt_status *s)\n \tx = git_path(\"info/exclude\");\n \tif (file_exists(x))\n \t\tadd_excludes_from_file(&dir, x);\n+\tif (excludes_file && file_exists(excludes_file))\n+\t\tadd_excludes_from_file(&dir, excludes_file);\n \n \tread_directory(&dir, \".\", \"\", 0, NULL);\n \tfor(i = 0; i < dir.nr; i++) {\n@@ -356,5 +359,11 @@ int git_status_config(const char *k, const char *v)\n \t\tint slot = parse_status_slot(k, 13);\n \t\tcolor_parse(v, k, wt_status_colors[slot]);\n \t}\n+\tif (!strcmp(k, \"core.excludesfile\")) {\n+\t\tif (!v)\n+\t\t\tdie(\"core.excludesfile without value\");\n+\t\texcludes_file = xstrdup(v);\n+\t\treturn 0;\n+\t}\n \treturn git_default_config(k, v);\n }\n-- \n1.5.2.746.g222b\n"}]}