{"thread":{"id":"40535","subject":"submodule: allow submodule directory in gitignore","startedAt":"2015-10-12T06:30:10Z","lastAt":"2015-10-19T02:24:26Z","messageCount":4,"participants":["Aleksey Komarov","Jiang Xin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"271435","messageId":"561B5372.7040508@gmail.com","threadId":"40535","inReplyTo":null,"subject":"submodule: allow submodule directory in gitignore","fromName":"Aleksey Komarov","fromEmail":"leeeeha@gmail.com","sentAt":"2015-10-12T06:30:10Z","receivedAt":"2015-10-12T06:30:10Z","isPatch":false,"sender":{"key":"leeeeha@gmail.com","avatar":null},"body":"Hi all!\n\nI'm sorry if the letter came twice. I have troubles with my post client.\n\nI want to organize my repository so its submodules would be located at the root\nof repository. I'm trying to create .gitignore to ignore all files and don't\nignore directories at the same time:\n\n$ cat .gitignore\n*\n!*/\n\nNow, I'm trying to add a submodule to my repository, but fail to understand why\nmy .gitignore prevents it from being added. I use the following command to check\nif my submodule will be ignored or not:\n\n$ git add --dry-run --ignore-missing c/\n\nI have noticed that result of this check is different when directory c/ already\nexists and when it still doesn't by the time of the check.\nThe described behavior is illustrated by the following example:\n\n$ mkdir git_test\n$ cd git_test\n$ git init\nInitialized empty Git repository in D:/temp/git_test/.git/\n$ echo \\* >> .gitignore\n$ echo \\!\\*\\/ >> .gitignore\n$ git add --dry-run --ignore-missing c/\nThe following paths are ignored by one of your .gitignore files:\nc/\nUse -f if you really want to add them.\n$ mkdir c\n$ git add --dry-run --ignore-missing c/\n$\n\nIs this behavior expected? If yes, where can I read about it? Which part of the\nGit documentation should I consult?\nHow should I correct my .gitignore to pass this check in both cases, when\ndirectory c/ exists and when it doesn't?\n"},{"id":"271808","messageId":"5620C46F.8040007@gmail.com","threadId":"40535","inReplyTo":"561B5372.7040508@gmail.com","subject":"Re: submodule: allow submodule directory in gitignore","fromName":"Aleksey Komarov","fromEmail":"leeeeha@gmail.com","sentAt":"2015-10-16T09:33:35Z","receivedAt":"2015-10-16T09:33:35Z","isPatch":false,"sender":{"key":"leeeeha@gmail.com","avatar":null},"body":"On 12.10.2015 13:30, Aleksey Komarov wrote:\n\n> Now, I'm trying to add a submodule to my repository, but fail to understand why\n> my .gitignore prevents it from being added. I use the following command to check\n> if my submodule will be ignored or not:\n> \n> $ git add --dry-run --ignore-missing c/\n\nBy the way I've just consulted documentation[1].\nCan --ignore-missing option be used for checking not already present\ndirectories, in addition to ordinary files?\n\n[1] https://git-scm.com/docs/git-add\n"},{"id":"271855","messageId":"CANYiYbHNX+j6BPahWdGQ2qVbvBV-wd-Bi=ZjDmRfbXCsboNXpg@mail.gmail.com","threadId":"40535","inReplyTo":"561B5372.7040508@gmail.com","subject":"Re: submodule: allow submodule directory in gitignore","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2015-10-17T12:46:51Z","receivedAt":"2015-10-17T12:46:51Z","isPatch":false,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2015-10-12 14:30 GMT+08:00 Aleksey Komarov <leeeeha@gmail.com>:\n> Hi all!\n>\n> I'm sorry if the letter came twice. I have troubles with my post client.\n>\n> I want to organize my repository so its submodules would be located at the root\n> of repository. I'm trying to create .gitignore to ignore all files and don't\n> ignore directories at the same time:\n>\n> $ cat .gitignore\n> *\n> !*/\n>\n> Now, I'm trying to add a submodule to my repository, but fail to understand why\n> my .gitignore prevents it from being added. I use the following command to check\n> if my submodule will be ignored or not:\n>\n> $ git add --dry-run --ignore-missing c/\n>\n> I have noticed that result of this check is different when directory c/ already\n> exists and when it still doesn't by the time of the check.\n> The described behavior is illustrated by the following example:\n>\n> $ mkdir git_test\n> $ cd git_test\n> $ git init\n> Initialized empty Git repository in D:/temp/git_test/.git/\n> $ echo \\* >> .gitignore\n> $ echo \\!\\*\\/ >> .gitignore\n> $ git add --dry-run --ignore-missing c/\n> The following paths are ignored by one of your .gitignore files:\n> c/\n> Use -f if you really want to add them.\n> $ mkdir c\n> $ git add --dry-run --ignore-missing c/\n> $\n>\n\nTo check how an entry (c/) is affected by .gitignore in different cases,\nyou can try this command:\n\n    $ git check-ignore -v c/\n"},{"id":"271887","messageId":"5624545A.5090102@gmail.com","threadId":"40535","inReplyTo":"CANYiYbHNX+j6BPahWdGQ2qVbvBV-wd-Bi=ZjDmRfbXCsboNXpg@mail.gmail.com","subject":"Re: submodule: allow submodule directory in gitignore","fromName":"Aleksey Komarov","fromEmail":"leeeeha@gmail.com","sentAt":"2015-10-19T02:24:26Z","receivedAt":"2015-10-19T02:24:26Z","isPatch":false,"sender":{"key":"leeeeha@gmail.com","avatar":null},"body":"\n\nOn 17.10.2015 19:46, Jiang Xin wrote:\n> 2015-10-12 14:30 GMT+08:00 Aleksey Komarov <leeeeha@gmail.com>:\n>> Hi all!\n>>\n>> I'm sorry if the letter came twice. I have troubles with my post client.\n>>\n>> I want to organize my repository so its submodules would be located at the root\n>> of repository. I'm trying to create .gitignore to ignore all files and don't\n>> ignore directories at the same time:\n>>\n>> $ cat .gitignore\n>> *\n>> !*/\n>>\n>> Now, I'm trying to add a submodule to my repository, but fail to understand why\n>> my .gitignore prevents it from being added. I use the following command to check\n>> if my submodule will be ignored or not:\n>>\n>> $ git add --dry-run --ignore-missing c/\n>>\n>> I have noticed that result of this check is different when directory c/ already\n>> exists and when it still doesn't by the time of the check.\n>> The described behavior is illustrated by the following example:\n>>\n>> $ mkdir git_test\n>> $ cd git_test\n>> $ git init\n>> Initialized empty Git repository in D:/temp/git_test/.git/\n>> $ echo \\* >> .gitignore\n>> $ echo \\!\\*\\/ >> .gitignore\n>> $ git add --dry-run --ignore-missing c/\n>> The following paths are ignored by one of your .gitignore files:\n>> c/\n>> Use -f if you really want to add them.\n>> $ mkdir c\n>> $ git add --dry-run --ignore-missing c/\n>> $\n>>\n> \n> To check how an entry (c/) is affected by .gitignore in different cases,\n> you can try this command:\n> \n>     $ git check-ignore -v c/\n\nI try it, but result is the same.\n\n$ rmdir c\n$ git check-ignore -v c/\n.gitignore:1:* c/\n$ mkdir c\n$ git check-ignore -v c/\n.gitignore:2:!*/ c/\n\nBehavior depends on whether c/ directory exists beforehand.\n"}]}