git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* query on git submodule (ignore)
@ 2018-03-25  2:17 prashant Nidgunde
  2018-03-25  7:10 ` Jacob Keller
  2018-03-25 16:46 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: prashant Nidgunde @ 2018-03-25  2:17 UTC (permalink / raw)
  To: git

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.

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)

If this feature is feasible , how do i know if its developed  (
awaiting merge ) or can I build the patch ?

Regards,
Prashant

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

* Re: query on git submodule (ignore)
  2018-03-25  2:17 query on git submodule (ignore) prashant Nidgunde
@ 2018-03-25  7:10 ` Jacob Keller
  2018-03-25 16:46 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Jacob Keller @ 2018-03-25  7:10 UTC (permalink / raw)
  To: prashant Nidgunde; +Cc: Git mailing list

On Sat, Mar 24, 2018 at 7:17 PM, prashant Nidgunde
<pashnidgunde@gmail.com> wrote:
> 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.
>
> 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)
>
> If this feature is feasible , how do i know if its developed  (
> awaiting merge ) or can I build the patch ?
>

I don't recall such a feature, but I'm sure patches to implement
something would be welcome to be reviewed! (For more information about
submitting patches you could read
https://github.com/git/git/blob/master/Documentation/SubmittingPatches)

I think having an option to automatically write this would be useful.
It may already be possible to do something similar via the git config
command with the -f file argument to edit the .gitmodules file (as it
uses the gitconfig format for its contents). However, this is
definitely not intuitive.

You can read the documentation for the commands using "git help
submodule" and "git help config". Patches are also definitely welcome
for updates to the documentation if it's not clear.


I know also that having a simpler interface to set submodules up so
that they are treated as unchanged would be useful as I have projects
at $dayjob which use submodules, and this is often a complaint against
their use by my co-workers (who sometimes then accidentally commit
re-wind updates to the submodules due to inattentiveness with use of
git add . or git commit -a).

Thanks,
Jake

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

* Re: query on git submodule (ignore)
  2018-03-25  2:17 query on git submodule (ignore) prashant Nidgunde
  2018-03-25  7:10 ` Jacob Keller
@ 2018-03-25 16:46 ` Junio C Hamano
  2018-03-26 18:55   ` Stefan Beller
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2018-03-25 16:46 UTC (permalink / raw)
  To: prashant Nidgunde; +Cc: git, Stefan Beller

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

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?

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

* Re: query on git submodule (ignore)
  2018-03-25 16:46 ` Junio C Hamano
@ 2018-03-26 18:55   ` Stefan Beller
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Beller @ 2018-03-26 18:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: pashnidgunde, git

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

> 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

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

end of thread, other threads:[~2018-03-26 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-25  2:17 query on git submodule (ignore) prashant Nidgunde
2018-03-25  7:10 ` Jacob Keller
2018-03-25 16:46 ` Junio C Hamano
2018-03-26 18:55   ` 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).