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

Re: query on git submodule (ignore)

From
Stefan Beller <sbeller@google.com>
Date
Mar 26, 2018, 18:55 UTC
Message-ID
<CAGZ79ka4Xfx3x09VtDOM9tD68et-DFPNCcSvJhB4G_Hb-+oPew@mail.gmail.com>
In-Reply-To
<xmqqk1u0f6ha.fsf@gitster-ct.c.googlers.com>
On Sun, Mar 25, 2018 at 9:46 AM Junio C Hamano <gitster@pobox.com> wrote:
> prashant Nidgunde <pashnidgunde@gmail.com> writes:
> [cc: stefan, for his interest in improving 'git submodules']
> > Hello,
> >
> > I am new to this community ,so please ignore if I am asking anything
silly.
> >
> > Case :
> > Today when I built my submodule , and did a git status , it shows as
modified.
Show 13 quoted lines
> >
> > After reading certain suggestions on web i found out that i can ignore
> > that adding a line in .gitmodules
> >
> > But, I had to add that line manually ( which could be errorprone
> > because of typos )
> >
> >
> > Question:
> >     1. Is it feasible to build a feature like :
> >                    git submodule "zlib" ignore dirty ( which will
> > ignore submodule zlib when its built and dirty  as it has new files in
> > its directory)
> How does it prevent you from saying
>          git submodule "glib" ignore dirty
Show 5 quoted lines
> when you really meant "zlib"?  How is the command supposed to know
> that you did *not* mean "glib", which may currently not exist in the
> index nor in the working tree yet but you are about to create, and
> doing the "ignore dirty" configuration as an earlier step of
> multiple steps to add a submodule?
> I personally doubt that the main issue you should be concerned about
> is feasibility.  A larger issue is how it is supposed to help, iow,
> is such a "feature" useful in the first place?
> Whenever you hear yourself say "I have to do X manually, and I can
> make mistakes. Can a command do it instead?", you have to ask
> yourself: what pieces of information do you give to that command,
> and how do you ensure you do not make typos on that command line?
> Besides, the above syntax would not work.  What would a user do when
> a submodule called "add" exists, for example?
I would think this can be solved by reordering the command to be
   git submodule ignore [--option-for-granularity=dirty] [-- <path-spec>]
However for now this would be a shallow wrapper to
   name=$(git submodule--helper name <one submodule path>)
   git config submodule.$name.ignore dirty

if I understand the requested feature correctly? Instead of coming up with each name for each submodule path (btw name and path are most often the same any way, just put it here for correctness), one could also use

   git submodule foreach -- \
       git -C .. config submodule.$name.ignore dirty
as the foreach already populates the $name variable.
Stefan
Previous: Junio C Hamano
Message 4 of 4 in “query on git submodule (ignore)”
  1. prashant NidgundeMar 25, 2018
  2. Jacob KellerMar 25, 2018
  3. Junio C HamanoMar 25, 2018
  4. Stefan BellerMar 26, 2018

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.