git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* BUG: The .gitignore rules can't be made to cross submodule boundaries
@ 2017-05-22 18:33 Ævar Arnfjörð Bjarmason
  2017-05-23  9:17 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-05-22 18:33 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Brandon Williams, Stefan Beller

When I was adding the sha1collisiondetection submodule to git.git I
noticed that building git would dirty the submodule.

This is because our own Makefile adds .depend/ directories. I hacked
around it by just getting the upstream project accept carrying an
ignore rule for that around:
https://github.com/cr-marcstevens/sha1collisiondetection/commit/e8397b26

A workaround for this is to have the Makefile add such a rule to
.git/modules/sha1collisiondetection/info/exclude, but that's less
convenient than being able to distribute it as a normal .gitignore
rule.

The submodule.<name>.ignore config provides an overly big hammer to
solve this, it would be better if we had something like
submodule.<name>.gitignore=<path>. Then we could have e.g.
.gitignore.sha1collisiondetection which would be added to whatever
rules the repo's own .gitignore provides.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: The .gitignore rules can't be made to cross submodule boundaries
  2017-05-22 18:33 BUG: The .gitignore rules can't be made to cross submodule boundaries Ævar Arnfjörð Bjarmason
@ 2017-05-23  9:17 ` Johannes Schindelin
  2017-05-23  9:55   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2017-05-23  9:17 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Git Mailing List, Brandon Williams, Stefan Beller

[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]

Hi Ævar,

On Mon, 22 May 2017, Ævar Arnfjörð Bjarmason wrote:

> When I was adding the sha1collisiondetection submodule to git.git I
> noticed that building git would dirty the submodule.
> 
> This is because our own Makefile adds .depend/ directories. I hacked
> around it by just getting the upstream project accept carrying an ignore
> rule for that around:
> https://github.com/cr-marcstevens/sha1collisiondetection/commit/e8397b26
> 
> A workaround for this is to have the Makefile add such a rule to
> .git/modules/sha1collisiondetection/info/exclude, but that's less
> convenient than being able to distribute it as a normal .gitignore rule.
> 
> The submodule.<name>.ignore config provides an overly big hammer to
> solve this, it would be better if we had something like
> submodule.<name>.gitignore=<path>. Then we could have e.g.
> .gitignore.sha1collisiondetection which would be added to whatever rules
> the repo's own .gitignore provides.

While I have nothing but the utmost respect for Stefan and Brandon for
trying to improve submodules, maybe it would be a wiser idea to imitate
the same strategy with sha1dc as we use with git-gui and gitk, i.e.
perform a subtree merge instead of adding it as a submodule. It's not like
570kB will kill us.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: The .gitignore rules can't be made to cross submodule boundaries
  2017-05-23  9:17 ` Johannes Schindelin
@ 2017-05-23  9:55   ` Ævar Arnfjörð Bjarmason
  2017-05-23 17:51     ` Stefan Beller
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-05-23  9:55 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List, Brandon Williams, Stefan Beller

On Tue, May 23, 2017 at 11:17 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi Ævar,
>
> On Mon, 22 May 2017, Ævar Arnfjörð Bjarmason wrote:
>
>> When I was adding the sha1collisiondetection submodule to git.git I
>> noticed that building git would dirty the submodule.
>>
>> This is because our own Makefile adds .depend/ directories. I hacked
>> around it by just getting the upstream project accept carrying an ignore
>> rule for that around:
>> https://github.com/cr-marcstevens/sha1collisiondetection/commit/e8397b26
>>
>> A workaround for this is to have the Makefile add such a rule to
>> .git/modules/sha1collisiondetection/info/exclude, but that's less
>> convenient than being able to distribute it as a normal .gitignore rule.
>>
>> The submodule.<name>.ignore config provides an overly big hammer to
>> solve this, it would be better if we had something like
>> submodule.<name>.gitignore=<path>. Then we could have e.g.
>> .gitignore.sha1collisiondetection which would be added to whatever rules
>> the repo's own .gitignore provides.
>
> While I have nothing but the utmost respect for Stefan and Brandon for
> trying to improve submodules, maybe it would be a wiser idea to imitate
> the same strategy with sha1dc as we use with git-gui and gitk, i.e.
> perform a subtree merge instead of adding it as a submodule. It's not like
> 570kB will kill us.

The submodule/.gitignore bug/feature-request being reported here isn't
something that impacts the ab/sha1dc series in practice.

It was something I noticed while working with an earlier commit in
that repo, but that's a commit that'll never be pinned by the
git.git:sha1collisiondetection submodule.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: The .gitignore rules can't be made to cross submodule boundaries
  2017-05-23  9:55   ` Ævar Arnfjörð Bjarmason
@ 2017-05-23 17:51     ` Stefan Beller
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Beller @ 2017-05-23 17:51 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Johannes Schindelin, Git Mailing List, Brandon Williams

On Tue, May 23, 2017 at 2:55 AM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Tue, May 23, 2017 at 11:17 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> Hi Ævar,
>>
>> On Mon, 22 May 2017, Ævar Arnfjörð Bjarmason wrote:
>>
>>> When I was adding the sha1collisiondetection submodule to git.git I
>>> noticed that building git would dirty the submodule.
>>>
>>> This is because our own Makefile adds .depend/ directories. I hacked
>>> around it by just getting the upstream project accept carrying an ignore
>>> rule for that around:
>>> https://github.com/cr-marcstevens/sha1collisiondetection/commit/e8397b26
>>>
>>> A workaround for this is to have the Makefile add such a rule to
>>> .git/modules/sha1collisiondetection/info/exclude, but that's less
>>> convenient than being able to distribute it as a normal .gitignore rule.
>>>
>>> The submodule.<name>.ignore config provides an overly big hammer to
>>> solve this, it would be better if we had something like
>>> submodule.<name>.gitignore=<path>. Then we could have e.g.
>>> .gitignore.sha1collisiondetection which would be added to whatever rules
>>> the repo's own .gitignore provides.
>>
>> While I have nothing but the utmost respect for Stefan and Brandon for
>> trying to improve submodules, maybe it would be a wiser idea to imitate
>> the same strategy with sha1dc as we use with git-gui and gitk, i.e.
>> perform a subtree merge instead of adding it as a submodule. It's not like
>> 570kB will kill us.

Actually that is a very valid bug report outside that series for the
behavior of submodules.

In a world where you use a submodule to track say a third party
library, the current behavior of .gitignore applying to each repo makes
sense.

When it is no third party, but a first party lib, then it is sensible to expect
that the building/testing infrastructure works across the whole repo set,
and the user wants just one central place to specify things, such as
ignoring certain files or applying .gitattributes.

This topic came up in various forms on the mailing list, most often for
config that ought to be applied across all repos[1].

That said I have no good idea yet how to fix this issue without introducing
the ultimate user confusion.

The conditional include of config files (by Duy as part of 2.13) seems like
an interesting approach, which we could build on top of.
We currently have a main config and a per-working-tree config, so I would
expect we'd introduce another config file that is included by all submodules
by default. It could be located in the superproject at ".git/config.super".
This config file could then specify

[submodule]
    recursiveIgnore = [yes/no]
    recursiveAttributes = [yes/no]

In that way commands run from within the submodule as well as from
the superproject would realize that the submodule needs to lookup
the superproject and use the attribute/ignore/config settings from there.

[1] Here the example for URL.insteadOf
https://public-inbox.org/git/CAPZ477MCsBsfbqKzp69MT_brwz-0aes6twJofQrhizUBV7ZoeA@mail.gmail.com/

>
> The submodule/.gitignore bug/feature-request being reported here isn't
> something that impacts the ab/sha1dc series in practice.
>
> It was something I noticed while working with an earlier commit in
> that repo, but that's a commit that'll never be pinned by the
> git.git:sha1collisiondetection submodule.

Thanks for the bug report. As outlined above, we'd still need to bikeshed
how to fix it properly I'd think.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-23 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 18:33 BUG: The .gitignore rules can't be made to cross submodule boundaries Ævar Arnfjörð Bjarmason
2017-05-23  9:17 ` Johannes Schindelin
2017-05-23  9:55   ` Ævar Arnfjörð Bjarmason
2017-05-23 17:51     ` Stefan Beller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).