git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git add --all does not respect submodule.<name>.ignore
@ 2018-01-30 20:25 Michael Scott-Nelson
  2018-01-30 21:56 ` Stefan Beller
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Scott-Nelson @ 2018-01-30 20:25 UTC (permalink / raw)
  To: git

Giving a submodule "ignore=all" or "ignore=dirty" in .gitmodule
successfully removes that module from `git status` queries. However,
these same diffs are automatically added by git-add, eg `git add .` or
`git add --all` adds the submodules that we want ignored. This seems
inconsistent and confusing.

Workflow reason:
We want to be able to have supers and subs checked-out, make changes
to both, but only update the SHA-1 pointer from super to sub when
explicitly forced to do so, eg `git add -f subName`. This workflow
prevents continuous merge conflicts from clashing SHA-1 pointers while
still allowing `git add --all`, allowing a sort of middle ground
between submodules and an untracked library.

Teaching git-add about submodule.ignore and/or teaching .gitignore
about submodules would be awesome.

Also experimented with `git update-index --assume-unchanged subName`,
but I believe that it does not get committed and besides also does not
seem to have a way to `git add -f`.
---
Note: currently on git version 2.14.1, but looking through the
changelogs, did not see any changes since then that would enable this
workflow.

-Michael Scott-Nelson

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

* Re: git add --all does not respect submodule.<name>.ignore
  2018-01-30 20:25 git add --all does not respect submodule.<name>.ignore Michael Scott-Nelson
@ 2018-01-30 21:56 ` Stefan Beller
  2018-01-30 23:38   ` Jacob Keller
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2018-01-30 21:56 UTC (permalink / raw)
  To: Michael Scott-Nelson, Brandon Williams; +Cc: git

On Tue, Jan 30, 2018 at 12:25 PM, Michael Scott-Nelson
<mscottnelson@gmail.com> wrote:
> Giving a submodule "ignore=all" or "ignore=dirty" in .gitmodule
> successfully removes that module from `git status` queries. However,
> these same diffs are automatically added by git-add, eg `git add .` or
> `git add --all` adds the submodules that we want ignored. This seems
> inconsistent and confusing.

My prime suspect for this change would be
https://github.com/git/git/commit/5556808690ea245708fb80383be5c1afee2fb3eb

> Workflow reason:
> We want to be able to have supers and subs checked-out, make changes
> to both, but only update the SHA-1 pointer from super to sub when
> explicitly forced to do so, eg `git add -f subName`. This workflow
> prevents continuous merge conflicts from clashing SHA-1 pointers while
> still allowing `git add --all`, allowing a sort of middle ground
> between submodules and an untracked library.

For that you want to set the ignore flag locally in .git/config instead of
.gitmodules. The .gitmodules seems like a convenient place to "share
submodule config", but that is a slippery slope and I think that was a
mistake by the project.

(If you control the environment, you could also put the ignore flags into
the system wide config)

> Teaching git-add about submodule.ignore and/or teaching .gitignore
> about submodules would be awesome.

I wonder if we can address this issue with even more config options.
(sounds bad, but is the first thought I have)

> Also experimented with `git update-index --assume-unchanged subName`,
> but I believe that it does not get committed and besides also does not
> seem to have a way to `git add -f`.

The assume-unchanged bit is a performance optimisation for powerusers,
but its documentation words it in a less dangerous way, such that it sounds
as if it is a UX feature instead of a performance thing. I'd stay away from
that know.

Stefan

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

* Re: git add --all does not respect submodule.<name>.ignore
  2018-01-30 21:56 ` Stefan Beller
@ 2018-01-30 23:38   ` Jacob Keller
  0 siblings, 0 replies; 3+ messages in thread
From: Jacob Keller @ 2018-01-30 23:38 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Michael Scott-Nelson, Brandon Williams, git

On Tue, Jan 30, 2018 at 1:56 PM, Stefan Beller <sbeller@google.com> wrote:
> The assume-unchanged bit is a performance optimisation for powerusers,
> but its documentation words it in a less dangerous way, such that it sounds
> as if it is a UX feature instead of a performance thing. I'd stay away from
> that know.
>
> Stefan

In almost all cases where someone incorrectly recommends
assume-unchanged, I think they could just use skip-worktree to get the
actual behavior they want.

Thanks,
Jake

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

end of thread, other threads:[~2018-01-30 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 20:25 git add --all does not respect submodule.<name>.ignore Michael Scott-Nelson
2018-01-30 21:56 ` Stefan Beller
2018-01-30 23:38   ` Jacob Keller

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).