Re: git commit vs. ignore-submodules

2014-03-29 Thread Ronald Weiss
On Fri, Mar 28, 2014 at 5:47 PM, Jens Lehmann  wrote:
> Such a patch would be very much appreciated. You might want to look
> into other commands that already have the --ignore-submodules option
> to get an idea how to do that. cmd_status() in builtin/commit.c
> should be a good starting point.

OK, I managed to create a patch, will post it as separate email right
after this one. I also had to touch builtin/add.c, to make the new
--ignore-submodes option work with "git commit -a" too.

>> And also, I'd like to know git folks' opinion on whether it's OK that
>> git commit with ignore=all in .gitmodules ignores submodules even when
>> they are explicitely staged with git add.
>
> No, they should be visible in status and commit when the user chose
> to add them. I see if I can hack something up (as I've been bitten
> myself by that recently ;-).

While I was playing with that now, I discovered that the problem is
actually not in commit, but only in status. Commit really commits the
submodule, but it's not visible in the commit message (generated by
status), that confused me before. And if there are no other changes in
the index, then commit fails immediately with "no changes". A small
change in wt-status.c fixes that for me, but I'm not sure about any
undesired side effects. I'll post a patch for that too, in a few
moments.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git commit vs. ignore-submodules

2014-03-28 Thread Junio C Hamano
Jens Lehmann  writes:

>> .. but it's less clear if one explicitely stages an updated
>> submodule using git add. Git commit will ignore it anyway, if
>> ignore=all is configured in .gitmodules. Maybe that's correct too

That definitely smells like a bug to me.  Excluding modified
submodules when "git add -u" is run with ignore=all would be fine
and most likely the right thing to do, but once the user actually
adds the change to the index, it should not be ignored.

> ...
>> And also, I'd like to know git folks' opinion on whether it's OK that
>> git commit with ignore=all in .gitmodules ignores submodules even when
>> they are explicitely staged with git add.
>
> No, they should be visible in status and commit when the user chose
> to add them. I see if I can hack something up (as I've been bitten
> myself by that recently ;-).

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: git commit vs. ignore-submodules

2014-03-28 Thread Jens Lehmann
Am 28.03.2014 00:36, schrieb Ronald Weiss:
> Hello.
> 
> As this is my first post to this list, let me first thank all the
> people involved in Git development - it's really a great tool.

Welcome and thanks for the feedback!

> Now to the point. Since Git 1.8 (I think), git commit command honours
> the submodules' ignore settings, configured either in .gitmodules, or
> in .git/config. That's very nice and certainly correct for "git commit
> -a", but it's less clear if one explicitely stages an updated
> submodule using git add. Git commit will ignore it anyway, if
> ignore=all is configured in .gitmodules. Maybe that's correct too, I'm
> not sure about that, but it's inconvenient in our use case, especially
> combined with the lack of --ignore-submodule parameter to git commit,
> as git status and git diff have.
> 
> We use submodules in such a way that normally we don't ever want to
> see changes in them in output of git diff and git status. So we set
> ignore=all in .gitmodules for each submodule. But occasionally, we
> need to add a new submodule, and sometimes also commit changed
> submodule. This got harder with Git 1.8, we have to "git config
> submodule..ignore none" before the commit, and "git config
> --unset ..." after.
> 
> I'd like to at least add an --ignore-submodules parameter to git
> commit. I though about posting a patch, but as I looked into the
> commit source file, I didn't see any straightforward way to implement
> it. I don't have enough free time for a deeper analysis of the
> sources, I'm sorry.
> 
> So please, let me first know, whether you could possibly accept such
> patch, and if so, then I'd really appreciate some hints on how to do
> it.

Such a patch would be very much appreciated. You might want to look
into other commands that already have the --ignore-submodules option
to get an idea how to do that. cmd_status() in builtin/commit.c
should be a good starting point.

> And also, I'd like to know git folks' opinion on whether it's OK that
> git commit with ignore=all in .gitmodules ignores submodules even when
> they are explicitely staged with git add.

No, they should be visible in status and commit when the user chose
to add them. I see if I can hack something up (as I've been bitten
myself by that recently ;-).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html