git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksey Komarov <leeeeha@gmail.com>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: submodule: allow submodule directory in gitignore
Date: Mon, 19 Oct 2015 09:24:26 +0700	[thread overview]
Message-ID: <5624545A.5090102@gmail.com> (raw)
In-Reply-To: <CANYiYbHNX+j6BPahWdGQ2qVbvBV-wd-Bi=ZjDmRfbXCsboNXpg@mail.gmail.com>



On 17.10.2015 19:46, Jiang Xin wrote:
> 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.

      reply	other threads:[~2015-10-19  2:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  6:30 submodule: allow submodule directory in gitignore Aleksey Komarov
2015-10-16  9:33 ` Aleksey Komarov
2015-10-17 12:46 ` Jiang Xin
2015-10-19  2:24   ` Aleksey Komarov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5624545A.5090102@gmail.com \
    --to=leeeeha@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=worldhello.net@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).