git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: submodule: allow submodule directory in gitignore

From
AKAleksey Komarov <leeeeha@gmail.com>
Date
Oct 19, 2015, 02:24 UTC
Message-ID
<5624545A.5090102@gmail.com>
In-Reply-To
<CANYiYbHNX+j6BPahWdGQ2qVbvBV-wd-Bi=ZjDmRfbXCsboNXpg@mail.gmail.com>
On 17.10.2015 19:46, Jiang Xin wrote:
Show 42 quoted lines
> 2015-10-12 14:30 GMT+08:00 Aleksey Komarov <leeeeha@gmail.com>:
>> Hi all!
>>
>> I'm sorry if the letter came twice. I have troubles with my post client.
>>
>> I want to organize my repository so its submodules would be located at the root
>> of repository. I'm trying to create .gitignore to ignore all files and don't
>> ignore directories at the same time:
>>
>> $ cat .gitignore
>> *
>> !*/
>>
>> Now, I'm trying to add a submodule to my repository, but fail to understand why
>> my .gitignore prevents it from being added. I use the following command to check
>> if my submodule will be ignored or not:
>>
>> $ git add --dry-run --ignore-missing c/
>>
>> I have noticed that result of this check is different when directory c/ already
>> exists and when it still doesn't by the time of the check.
>> The described behavior is illustrated by the following example:
>>
>> $ mkdir git_test
>> $ cd git_test
>> $ git init
>> Initialized empty Git repository in D:/temp/git_test/.git/
>> $ echo \* >> .gitignore
>> $ echo \!\*\/ >> .gitignore
>> $ git add --dry-run --ignore-missing c/
>> The following paths are ignored by one of your .gitignore files:
>> c/
>> Use -f if you really want to add them.
>> $ mkdir c
>> $ git add --dry-run --ignore-missing c/
>> $
>>
> 
> To check how an entry (c/) is affected by .gitignore in different cases,
> you can try this command:
> 
>     $ git check-ignore -v c/
I try it, but result is the same.

$ rmdir c $ git check-ignore -v c/ .gitignore:1:* c/ $ mkdir c $ git check-ignore -v c/ .gitignore:2:!*/ c/

Behavior depends on whether c/ directory exists beforehand.
Previous: Jiang Xin
Message 4 of 4 in “submodule: allow submodule directory in gitignore”
  1. Aleksey KomarovOct 12, 2015
  2. Aleksey KomarovOct 16, 2015
  3. Jiang XinOct 17, 2015
  4. Aleksey KomarovOct 19, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.