{"thread":{"id":"36741","subject":"[PATCH v3] Add an explicit GIT_DIR to the list of excludes","startedAt":"2014-05-23T17:33:31Z","lastAt":"2014-05-29T10:34:20Z","messageCount":10,"participants":["Pasha Bolokhov","Junio C Hamano","Duy Nguyen","Jakub Narębski"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"242585","messageId":"1400866411-14584-1-git-send-email-pasha.bolokhov@gmail.com","threadId":"36741","inReplyTo":null,"subject":"[PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Pasha Bolokhov","fromEmail":"pasha.bolokhov@gmail.com","sentAt":"2014-05-23T17:33:31Z","receivedAt":"2014-05-23T17:33:31Z","isPatch":true,"sender":{"key":"pasha.bolokhov@gmail.com","avatar":null},"body":"When an explicit '--git-dir' option points to a directory inside\nthe work tree, git treats it as if it were any other directory.\nIn particular, 'git status' lists it as untracked, while 'git add -A'\nstages the metadata directory entirely\n\nAdd GIT_DIR to the list of excludes in setup_standard_excludes(),\nwhile checking that GIT_DIR is not just '.git', in which case it\nwould be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n\nAlthough an analogous comparison of any given path against '.git'\nis done in treat_path(), this does not seem to be the right place\nto compare against GIT_DIR. Instead, the excludes provide an\neffective mechanism of ignoring a file/directory, and adding GIT_DIR\nas an exclude is equivalent of putting it into '.gitignore'. Function\nsetup_standard_excludes() was chosen because that is the place where\nthe excludes are initialized by the commands that are concerned about\nexcludes\n\nSigned-off-by: Pasha Bolokhov <pasha.bolokhov@gmail.com>\n---\nSlightly brush-up comments, and fix \">file\" style in the test, together\nwith fixing the &&-chain.\nOne thing is, when you do \"git --git-dir meta init\", and then explicitly\nsay \"add meta/\", the message you get is\n\"The following paths are ignored by one of your .gitignore files:\"\nwhich is not exactly correct.\n\n Documentation/technical/api-directory-listing.txt |  4 +-\n dir.c                                             | 20 ++++++\n t/t2205-add-gitdir.sh                             | 84 +++++++++++++++++++++++\n 3 files changed, 106 insertions(+), 2 deletions(-)\n create mode 100755 t/t2205-add-gitdir.sh\n\ndiff --git a/Documentation/technical/api-directory-listing.txt b/Documentation/technical/api-directory-listing.txt\nindex 7f8e78d..fd4a178 100644\n--- a/Documentation/technical/api-directory-listing.txt\n+++ b/Documentation/technical/api-directory-listing.txt\n@@ -90,8 +90,8 @@ marked. If you to exclude files, make sure you have loaded index first.\n   `add_exclude()`.\n \n * To add patterns from a file (e.g. `.git/info/exclude`), call\n-  `add_excludes_from_file()` , and/or set `dir.exclude_per_dir`.  A\n-  short-hand function `setup_standard_excludes()` can be used to set\n+  `add_excludes_from_file()` , and/or set `dir.exclude_per_dir`.  The\n+  short-hand function `setup_standard_excludes()` must be used to set\n   up the standard set of exclude settings.\n \n * Set options described in the Data Structure section above.\ndiff --git a/dir.c b/dir.c\nindex 98bb50f..76969a7 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -1588,6 +1588,26 @@ void setup_standard_excludes(struct dir_struct *dir)\n {\n \tconst char *path;\n \tchar *xdg_path;\n+\tconst char *gitdir = get_git_dir();\n+\n+\t/* Add git directory to the ignores first */\n+\tif (strcmp(gitdir, \".git\") != 0) { /* \"--git-dir\" has been given */\n+\t\tchar ngit[PATH_MAX + 1];\n+\n+\t\t/*\n+\t\t * See if GIT_DIR is inside the work tree; need to normalize\n+\t\t * 'gitdir', whereas 'get_git_work_tree()' always appears\n+\t\t * absolute and normalized\n+\t\t */\n+\t\tnormalize_path_copy(ngit, real_path(absolute_path(gitdir)));\n+\n+\t\tif (dir_inside_of(ngit, get_git_work_tree()) >= 0) {\n+\t\t\tstruct exclude_list *el = add_exclude_list(dir, EXC_CMDL,\n+\t\t\t\t\t\t\t\"--git-dir option\");\n+\n+\t\t\tadd_exclude(gitdir, \"\", 0, el, 0);\n+\t\t}\n+\t}\n \n \tdir->exclude_per_dir = \".gitignore\";\n \tpath = git_path(\"info/exclude\");\ndiff --git a/t/t2205-add-gitdir.sh b/t/t2205-add-gitdir.sh\nnew file mode 100755\nindex 0000000..0c99508\n--- /dev/null\n+++ b/t/t2205-add-gitdir.sh\n@@ -0,0 +1,84 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2014 Pasha Bolokhov\n+#\n+\n+test_description='alternative repository path specified by --git-dir is ignored by add and status'\n+\n+. ./test-lib.sh\n+\n+#\n+# Create a tree:\n+#\n+# \ta  b  c  d  subdir/\n+#\n+# subdir:\n+# \te  f  g  h  meta/  ssubdir/\n+#\n+# subdir/meta:\n+# \taa\n+#\n+# subdir/ssubdir:\n+# \tmeta/\n+#\n+# subdir/ssubdir/meta:\n+# \taaa\n+#\n+# Name the repository \"meta\" and see whether or not \"git status\" includes\n+# or ignores directories named \"meta\". The slightly deeper hierarchy is\n+# needed in order to be able to put the repository into \"../meta\", that is,\n+# outside the work tree and still have files called \"meta\" within the tree\n+#\n+\n+test_expect_success \"setup\" '\n+\tgit --git-dir=meta init &&\n+\tfor f in a b c d\n+\tdo\n+\t\techo \"DATA\" >\"$f\" || exit 1\n+\tdone &&\n+\tmkdir subdir &&\n+\tfor f in e f g h\n+\tdo\n+\t\techo \"MORE DATA\" >\"subdir/$f\" || exit 1\n+\tdone &&\n+\tmkdir subdir/meta &&\n+\techo \"EVEN more Data\" >subdir/meta/aa &&\n+\tmkdir subdir/ssubdir subdir/ssubdir/meta &&\n+\techo \"So much more data\" >subdir/ssubdir/meta/aaa\n+'\n+\n+test_expect_success \"'git status' ignores the repository directory\" '\n+\tgit --git-dir=meta --work-tree=. status --porcelain >status.out &&\n+\ttest_might_fail grep meta status.out >out &&\n+\t! test -s out\n+'\n+\n+test_expect_success \"'git add -A' ignores the repository directory\" '\n+\tgit --git-dir=meta --work-tree=. add -A &&\n+\tgit --git-dir=meta --work-tree=. status --porcelain >status1.out &&\n+\ttest_might_fail grep meta status1.out >out1 &&\n+\t! test -s out1\n+'\n+\n+test_expect_success \"'git status' acknowledges files 'meta' if repository is not within work tree\" '\n+\ttest_might_fail rm -rf meta/ &&\n+\t(\n+\t\tcd subdir &&\n+\t\tgit --git-dir=../meta init &&\n+\t\tgit --git-dir=../meta --work-tree=. status --porcelain >status2.out &&\n+\t\ttest_might_fail grep meta status2.out >out2 &&\n+\t\ttest -s out2\n+\t)\n+'\n+\n+test_expect_success \"'git add -A' adds 'meta' if the repository is outside the work tree\" '\n+\t(\n+\t\tcd subdir &&\n+\t\tgit --git-dir=../meta --work-tree=. add -A &&\n+\t\tgit --git-dir=../meta --work-tree=. status --porcelain >status3.out &&\n+\t\ttest_might_fail grep meta status3.out >out3 &&\n+\t\ttest -s out3\n+\t)\n+'\n+\n+test_done\n-- \n1.9.1\n"},{"id":"242611","messageId":"xmqqha4gi5vg.fsf@gitster.dls.corp.google.com","threadId":"36741","inReplyTo":"1400866411-14584-1-git-send-email-pasha.bolokhov@gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-05-23T20:42:43Z","receivedAt":"2014-05-23T20:42:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pasha Bolokhov <pasha.bolokhov@gmail.com> writes:\n\n> diff --git a/dir.c b/dir.c\n> index 98bb50f..76969a7 100644\n> --- a/dir.c\n> +++ b/dir.c\n> @@ -1588,6 +1588,26 @@ void setup_standard_excludes(struct dir_struct *dir)\n>  {\n>  \tconst char *path;\n>  \tchar *xdg_path;\n> +\tconst char *gitdir = get_git_dir();\n> +\n> +\t/* Add git directory to the ignores first */\n> +\tif (strcmp(gitdir, \".git\") != 0) {\n\nIt is more idiomatic and common to say\n\n\tif (strcmp(gitdir, \".git\")) {\n\naround here, I think.\n\n>     /* \"--git-dir\" has been given */\n\n... or it could have come from GIT_DIR environment, no?\n\nDoes this \"additional exclude\" need to kick in if GIT_DIR is set to\n\"/home/pasha/w/.git\"?  That is, when gitdir is \".git\" or ends with\n\"/.git\"?\n\n> +\t\tchar ngit[PATH_MAX + 1];\n\nHmmm.  As I recall that recently we had flurry of changes to\neradicate PATH_MAX from our codebase, I am not happy to see an\nintroduction of a new buffer that is fixed-size.\n\n> +\t\t/*\n> +\t\t * See if GIT_DIR is inside the work tree; need to normalize\n> +\t\t * 'gitdir', whereas 'get_git_work_tree()' always appears\n> +\t\t * absolute and normalized\n> +\t\t */\n> +\t\tnormalize_path_copy(ngit, real_path(absolute_path(gitdir)));\n> +\n> +\t\tif (dir_inside_of(ngit, get_git_work_tree()) >= 0) {\n> +\t\t\tstruct exclude_list *el = add_exclude_list(dir, EXC_CMDL,\n> +\t\t\t\t\t\t\t\"--git-dir option\");\n> +\n> +\t\t\tadd_exclude(gitdir, \"\", 0, el, 0);\n> +\t\t}\n> +\t}\n>  \n>  \tdir->exclude_per_dir = \".gitignore\";\n>  \tpath = git_path(\"info/exclude\");\n> diff --git a/t/t2205-add-gitdir.sh b/t/t2205-add-gitdir.sh\n> new file mode 100755\n> index 0000000..0c99508\n> --- /dev/null\n> +++ b/t/t2205-add-gitdir.sh\n> @@ -0,0 +1,84 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2014 Pasha Bolokhov\n> +#\n> +\n> +test_description='alternative repository path specified by --git-dir is ignored by add and status'\n> +\n> +. ./test-lib.sh\n> +\n> +#\n> +# Create a tree:\n> +#\n> +# \ta  b  c  d  subdir/\n> +#\n> +# subdir:\n> +# \te  f  g  h  meta/  ssubdir/\n> +#\n> +# subdir/meta:\n> +# \taa\n> +#\n> +# subdir/ssubdir:\n> +# \tmeta/\n> +#\n> +# subdir/ssubdir/meta:\n> +# \taaa\n> +#\n> +# Name the repository \"meta\" and see whether or not \"git status\" includes\n> +# or ignores directories named \"meta\". The slightly deeper hierarchy is\n> +# needed in order to be able to put the repository into \"../meta\", that is,\n> +# outside the work tree and still have files called \"meta\" within the tree\n> +#\n\nIt is not quite clear with this large blob of comment what are\nnoises and what exactly are being tested.  I think you have two\ndirectories called \"meta\", but which one is the repository?  Or do\nyou have yet another one next to {a,b,c,d,subdir} called \"meta\" that\nis not listed above?\n\nGiven that the reason why people use --git-dir is so that they can\nput it completely outside the working tree (in which case, the usual\n\"start from cwd and go upwards while trying to see if there is .git/\nthat governs the working tree\" logic would not work), readers would\nnot expect to find the directory to be used as GIT_DIR in the\nhierarchy you are creating in the first place.  Because of that, it\nis even more important to clearify which \"meta\" you mean to use as\nyour GIT_DIR if you want to be understood by readers.\n"},{"id":"242623","messageId":"CAKpPgvdR5vwSMk0w_uMH8oDKAgH+v1v5JnQOSbaiZt4aNxO0qA@mail.gmail.com","threadId":"36741","inReplyTo":"xmqqha4gi5vg.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Pasha Bolokhov","fromEmail":"pasha.bolokhov@gmail.com","sentAt":"2014-05-23T22:40:59Z","receivedAt":"2014-05-23T22:40:59Z","isPatch":true,"sender":{"key":"pasha.bolokhov@gmail.com","avatar":null},"body":"       Hi,\n\n>\n>>     /* \"--git-dir\" has been given */\n>\n> ... or it could have come from GIT_DIR environment, no?\n    Yes, it does not matter where it came from, but I'll correct the comment\n\n>\n> Does this \"additional exclude\" need to kick in if GIT_DIR is set to\n> \"/home/pasha/w/.git\"?  That is, when gitdir is \".git\" or ends with\n> \"/.git\"?\n    I don't think it needs to kick in in either of these cases, as\n\".git\" is already handled by \"treat_path()\". Now, here \".git\" is\nexcluded by \"if (strcmp()) {\", while the first case needs to be\naddressed too. Agree.\n\n>> +#\n>> +# Create a tree:\n>> +#\n>> +#    a  b  c  d  subdir/\n>> +#\n>> +# subdir:\n>> +#    e  f  g  h  meta/  ssubdir/\n>> +#\n>> +# subdir/meta:\n>> +#    aa\n>> +#\n>> +# subdir/ssubdir:\n>> +#    meta/\n>> +#\n>> +# subdir/ssubdir/meta:\n>> +#    aaa\n>> +#\n> It is not quite clear with this large blob of comment what are\n> noises and what exactly are being tested.  I think you have two\n> directories called \"meta\", but which one is the repository?  Or do\n> you have yet another one next to {a,b,c,d,subdir} called \"meta\" that\n> is not listed above?\n>\n> Given that the reason why people use --git-dir is so that they can\n> put it completely outside the working tree (in which case, the usual\n> \"start from cwd and go upwards while trying to see if there is .git/\n> that governs the working tree\" logic would not work), readers would\n> not expect to find the directory to be used as GIT_DIR in the\n> hierarchy you are creating in the first place.  Because of that, it\n> is even more important to clearify which \"meta\" you mean to use as\n> your GIT_DIR if you want to be understood by readers.\n\nI guess I was too simplistic, need to clarify a bit. And indeed,\nperhaps two distinct subtrees are needed to test the repository that\nis outside the work-tree, that would just do a slightly cleaner job\n\nPasha\n"},{"id":"242631","messageId":"CACsJy8CDeTn8h8uUn_=6ek7BJueN_1i01TB_AeH03RKnf6tNSw@mail.gmail.com","threadId":"36741","inReplyTo":"1400866411-14584-1-git-send-email-pasha.bolokhov@gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-05-24T01:41:02Z","receivedAt":"2014-05-24T01:41:02Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov\n<pasha.bolokhov@gmail.com> wrote:\n> When an explicit '--git-dir' option points to a directory inside\n> the work tree, git treats it as if it were any other directory.\n> In particular, 'git status' lists it as untracked, while 'git add -A'\n> stages the metadata directory entirely\n>\n> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n> while checking that GIT_DIR is not just '.git', in which case it\n> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>\n> Although an analogous comparison of any given path against '.git'\n> is done in treat_path(), this does not seem to be the right place\n> to compare against GIT_DIR. Instead, the excludes provide an\n> effective mechanism of ignoring a file/directory, and adding GIT_DIR\n> as an exclude is equivalent of putting it into '.gitignore'. Function\n> setup_standard_excludes() was chosen because that is the place where\n> the excludes are initialized by the commands that are concerned about\n> excludes\n\nI like this approach. A search of \"exclude-standard\" in Documentation/\ngives git-grep.txt and git-ls-files.txt. I don't know if we need to\nadd something about this extra exclude rule to those .txt. If it's so\nobvious that this should be the expected behavior, then probably not.\n\nThe case of \"git grep --exclude-standard\" is interesting because it's\nintended to work without a repository. First reaction was would\nget_git_dir() return NULL in that case. But it should return \".git\" so\nwe're good.\n-- \nDuy\n"},{"id":"242754","messageId":"CAKpPgvfqTBxFXOaStEyyS7wAdR5aUsEOX_M2gPvGz4_dJYvTOA@mail.gmail.com","threadId":"36741","inReplyTo":"CACsJy8CDeTn8h8uUn_=6ek7BJueN_1i01TB_AeH03RKnf6tNSw@mail.gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Pasha Bolokhov","fromEmail":"pasha.bolokhov@gmail.com","sentAt":"2014-05-27T17:16:04Z","receivedAt":"2014-05-27T17:16:04Z","isPatch":true,"sender":{"key":"pasha.bolokhov@gmail.com","avatar":null},"body":">> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n>> while checking that GIT_DIR is not just '.git', in which case it\n>> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>>\n> gives git-grep.txt and git-ls-files.txt. I don't know if we need to\n> add something about this extra exclude rule to those .txt. If it's so\n> obvious that this should be the expected behavior, then probably not.\n\n    I suggest this. There appears to be a notion of \"standard\nexcludes\" both in the code (dir.c) and in the man pages (git-grep,\ngit-ls-files). However, it doesn't actually appear to be defined\nstrictly speaking. So my suggestion is to define those \"standard\nexcludes\" in one place (say \"gitignore(5)\"), and make other man pages\n(git-config, git-grip, git-ls-files) have references to that place\ninstead of explaining every time in detail what is being excluded.\nNow, gitignore(5) actually does have this list of ignored items, we\nonly need to call it \"standard excludes\".\n    If done this way, then all that needs to be done regarding GIT_DIR\nis to insert it into that list in gitignore(5). Please let me know if\nthat'd work\n\nPasha\n"},{"id":"242755","messageId":"xmqqd2ezgkt4.fsf@gitster.dls.corp.google.com","threadId":"36741","inReplyTo":"CACsJy8CDeTn8h8uUn_=6ek7BJueN_1i01TB_AeH03RKnf6tNSw@mail.gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-05-27T18:04:23Z","receivedAt":"2014-05-27T18:04:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov\n> <pasha.bolokhov@gmail.com> wrote:\n>> When an explicit '--git-dir' option points to a directory inside\n>> the work tree, git treats it as if it were any other directory.\n>> In particular, 'git status' lists it as untracked, while 'git add -A'\n>> stages the metadata directory entirely\n>>\n>> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n>> while checking that GIT_DIR is not just '.git', in which case it\n>> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>>\n>> Although an analogous comparison of any given path against '.git'\n>> is done in treat_path(), this does not seem to be the right place\n>> to compare against GIT_DIR. Instead, the excludes provide an\n>> effective mechanism of ignoring a file/directory, and adding GIT_DIR\n>> as an exclude is equivalent of putting it into '.gitignore'. Function\n>> setup_standard_excludes() was chosen because that is the place where\n>> the excludes are initialized by the commands that are concerned about\n>> excludes\n>\n> I like this approach. A search of \"exclude-standard\" in Documentation/\n> gives git-grep.txt and git-ls-files.txt. I don't know if we need to\n> add something about this extra exclude rule to those .txt. If it's so\n> obvious that this should be the expected behavior, then probably not.\n\nOK, so is that an Acked/Reviewed-by?\n\n>\n> The case of \"git grep --exclude-standard\" is interesting because it's\n> intended to work without a repository. First reaction was would\n> get_git_dir() return NULL in that case. But it should return \".git\" so\n> we're good.\n"},{"id":"242818","messageId":"CAKpPgvc8Ju0dWiuwk=0=_72SLcK57wAXwiRkjs_us3EW+L_jjw@mail.gmail.com","threadId":"36741","inReplyTo":"xmqqd2ezgkt4.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Pasha Bolokhov","fromEmail":"pasha.bolokhov@gmail.com","sentAt":"2014-05-27T21:46:55Z","receivedAt":"2014-05-27T21:46:55Z","isPatch":true,"sender":{"key":"pasha.bolokhov@gmail.com","avatar":null},"body":"I've sent out version [PATCH v4] with most of the things addressed.\nThat one hasn't been reviewed by anyone yet\n\n\nOn Tue, May 27, 2014 at 11:04 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> On Sat, May 24, 2014 at 12:33 AM, Pasha Bolokhov\n>> <pasha.bolokhov@gmail.com> wrote:\n>>> When an explicit '--git-dir' option points to a directory inside\n>>> the work tree, git treats it as if it were any other directory.\n>>> In particular, 'git status' lists it as untracked, while 'git add -A'\n>>> stages the metadata directory entirely\n>>>\n>>> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n>>> while checking that GIT_DIR is not just '.git', in which case it\n>>> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>>>\n>>> Although an analogous comparison of any given path against '.git'\n>>> is done in treat_path(), this does not seem to be the right place\n>>> to compare against GIT_DIR. Instead, the excludes provide an\n>>> effective mechanism of ignoring a file/directory, and adding GIT_DIR\n>>> as an exclude is equivalent of putting it into '.gitignore'. Function\n>>> setup_standard_excludes() was chosen because that is the place where\n>>> the excludes are initialized by the commands that are concerned about\n>>> excludes\n>>\n>> I like this approach. A search of \"exclude-standard\" in Documentation/\n>> gives git-grep.txt and git-ls-files.txt. I don't know if we need to\n>> add something about this extra exclude rule to those .txt. If it's so\n>> obvious that this should be the expected behavior, then probably not.\n>\n> OK, so is that an Acked/Reviewed-by?\n>\n>>\n>> The case of \"git grep --exclude-standard\" is interesting because it's\n>> intended to work without a repository. First reaction was would\n>> get_git_dir() return NULL in that case. But it should return \".git\" so\n>> we're good.\n"},{"id":"242886","messageId":"5386309E.3070003@gmail.com","threadId":"36741","inReplyTo":"CAKpPgvfqTBxFXOaStEyyS7wAdR5aUsEOX_M2gPvGz4_dJYvTOA@mail.gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2014-05-28T18:53:18Z","receivedAt":"2014-05-28T18:53:18Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"W dniu 2014-05-27 19:16, Pasha Bolokhov pisze:\n>>> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n>>> while checking that GIT_DIR is not just '.git', in which case it\n>>> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>>>\n>> gives git-grep.txt and git-ls-files.txt. I don't know if we need to\n>> add something about this extra exclude rule to those .txt. If it's so\n>> obvious that this should be the expected behavior, then probably not.\n>\n>      I suggest this. There appears to be a notion of \"standard\n> excludes\" both in the code (dir.c) and in the man pages (git-grep,\n> git-ls-files). However, it doesn't actually appear to be defined\n> strictly speaking. So my suggestion is to define those \"standard\n> excludes\" in one place (say \"gitignore(5)\"), and make other man pages\n> (git-config, git-grip, git-ls-files) have references to that place\n> instead of explaining every time in detail what is being excluded.\n\nOr define those \"standard excludes\" in standard-excludes.txt \"partial\",\nand include said file from git-grep(1), git-ls-files(1), and perhaps \ngitignore(5).\n\n-- \nJakub Narębski\n"},{"id":"242925","messageId":"CAKpPgvcMJCYS9jfq+XhfZzT6w4RgBvMypqo2BsAWK2XYt2BPBg@mail.gmail.com","threadId":"36741","inReplyTo":"5386309E.3070003@gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Pasha Bolokhov","fromEmail":"pasha.bolokhov@gmail.com","sentAt":"2014-05-29T02:33:48Z","receivedAt":"2014-05-29T02:33:48Z","isPatch":true,"sender":{"key":"pasha.bolokhov@gmail.com","avatar":null},"body":"Agree, but \"partial\" here means... what? just a little doc?\n\n\nOn Wed, May 28, 2014 at 11:53 AM, Jakub Narębski <jnareb@gmail.com> wrote:\n> W dniu 2014-05-27 19:16, Pasha Bolokhov pisze:\n>\n>>>> Add GIT_DIR to the list of excludes in setup_standard_excludes(),\n>>>> while checking that GIT_DIR is not just '.git', in which case it\n>>>> would be ignored by default, and that GIT_DIR is inside GIT_WORK_TREE\n>>>>\n>>> gives git-grep.txt and git-ls-files.txt. I don't know if we need to\n>>> add something about this extra exclude rule to those .txt. If it's so\n>>> obvious that this should be the expected behavior, then probably not.\n>>\n>>\n>>      I suggest this. There appears to be a notion of \"standard\n>> excludes\" both in the code (dir.c) and in the man pages (git-grep,\n>> git-ls-files). However, it doesn't actually appear to be defined\n>> strictly speaking. So my suggestion is to define those \"standard\n>> excludes\" in one place (say \"gitignore(5)\"), and make other man pages\n>> (git-config, git-grip, git-ls-files) have references to that place\n>> instead of explaining every time in detail what is being excluded.\n>\n>\n> Or define those \"standard excludes\" in standard-excludes.txt \"partial\",\n> and include said file from git-grep(1), git-ls-files(1), and perhaps\n> gitignore(5).\n>\n> --\n> Jakub Narębski\n>\n>\n"},{"id":"242928","messageId":"CANQwDwfC93uG7+mv0XpxuRWQP+yGS0F94OHk7AUcy_WfQ7VtQQ@mail.gmail.com","threadId":"36741","inReplyTo":"CAKpPgvcMJCYS9jfq+XhfZzT6w4RgBvMypqo2BsAWK2XYt2BPBg@mail.gmail.com","subject":"Re: [PATCH v3] Add an explicit GIT_DIR to the list of excludes","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2014-05-29T10:34:20Z","receivedAt":"2014-05-29T10:34:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, May 29, 2014 at 4:33 AM, Pasha Bolokhov\n<pasha.bolokhov@gmail.com> wrote:\n>\n> Agree, but \"partial\" here means... what? just a little doc?\n\nI'm sorry, I tried to be cute and failed :$\n\nThis is not official name for documentation files that are meant for inclusion\nand not as standalone manpages.  I think they are similar to 'partial templates'\nhttp://guides.rubyonrails.org/layouts_and_rendering.html#using-partials\n- usually just called \"partials\" - hence my use of this name.\n\nExample: date-formats.txt included in git-commit(1), git-commit-tree(1)\nand git-tag(1).\n\n> On Wed, May 28, 2014 at 11:53 AM, Jakub Narębski <jnareb@gmail.com> wrote:\n>> W dniu 2014-05-27 19:16, Pasha Bolokhov pisze:\n[...]\n>>>      I suggest this. There appears to be a notion of \"standard\n>>> excludes\" both in the code (dir.c) and in the man pages (git-grep,\n>>> git-ls-files). However, it doesn't actually appear to be defined\n>>> strictly speaking. So my suggestion is to define those \"standard\n>>> excludes\" in one place (say \"gitignore(5)\"), and make other man pages\n>>> (git-config, git-grip, git-ls-files) have references to that place\n>>> instead of explaining every time in detail what is being excluded.\n>>\n>>\n>> Or define those \"standard excludes\" in standard-excludes.txt \"partial\",\n>> and include said file from git-grep(1), git-ls-files(1), and perhaps\n>> gitignore(5).\n\n-- \nJakub Narębski\n"}]}