Re: query on git submodule (ignore)

2018-03-26 Thread Stefan Beller
On Sun, Mar 25, 2018 at 9:46 AM Junio C Hamano  wrote:

> prashant Nidgunde  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] [-- ]

However for now this would be a shallow wrapper to

   name=$(git submodule--helper name )
   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


Re: query on git submodule (ignore)

2018-03-25 Thread Junio C Hamano
prashant Nidgunde  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?


Re: query on git submodule (ignore)

2018-03-25 Thread Jacob Keller
On Sat, Mar 24, 2018 at 7:17 PM, prashant Nidgunde
 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


query on git submodule (ignore)

2018-03-24 Thread prashant Nidgunde
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