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

Re: [PATCH] commit: configure submodules

From
Orgad Shaneh <orgads@gmail.com>
Date
Sep 24, 2012, 19:59 UTC
Message-ID
<CAGHpTBLs2tgUunDtFMhw7QMiuB2oXBtQJLKpLckhEyDp7Zr+Qg@mail.gmail.com>
In-Reply-To
<5060BADB.2000505@web.de>
On Mon, Sep 24, 2012 at 9:56 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
Show 74 quoted lines
> Am 24.09.2012 21:16, schrieb Orgad Shaneh:
>> On Mon, Sep 24, 2012 at 9:06 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Orgad Shaneh <orgads@gmail.com> writes:
>>>
>>>> That is not correct. git-config is ignored as well for commit.
>>>
>>> What do you mean?  As far as I can tell, if you have
>>>
>>>     [submodule "var"]
>>>         path = var
>>>         ignore = dirty
>>>
>>> in $GIT_DIR/config, a work-tree-dirty submodule "var" is not
>>> reported by "git status" and "git commit" without your patch, and
>>> your patch does not seem to break that.  The only difference your
>>> patch makes is that if you had the above three-line block in
>>> the .gitmodules file and not in $GIT_DIR/config, "git status"
>>> ignored the dirtyness in the working tree, but "git commit" did
>>> notice and report it.
>>>
>>> What am I missing?
>>>
>>>
>>
>> I have:
>> [submodule "mod"]
>>         url = [...]
>>         ignore = dirty
>>
>> in .git/config, and I removed the ignore part from .gitmodules to be even.
>>
>> I made a change inside mod, git status doesn't report its dirtiness,
>> while git commit does.
>>
>> git status:
>> # On branch master
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       modified:   foo
>> #
>> # Changes not staged for commit:
>> #   (use "git add <file>..." to update what will be committed)
>> #   (use "git checkout -- <file>..." to discard changes in working directory)
>> #
>> #       modified:   .gitmodules
>> #
>>
>> git commit:
>> # Please enter the commit message for your changes. Lines starting
>> # with '#' will be ignored, and an empty message aborts the commit.
>> # On branch master
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       modified:   foo
>> #
>> # Changes not staged for commit:
>> #   (use "git add <file>..." to update what will be committed)
>> #   (use "git checkout -- <file>..." to discard changes in working directory)
>> #   (commit or discard the untracked or modified content in submodules)
>> #
>> #       modified:   .gitmodules
>> #       modified:   mod (modified content)
>> #
>>
>> Now I get it! That's because I don't have submodule.mod.path!
>> config_name_for_path only gets initialized if path exists. Apparently
>> git submodule init doesn't configure 'path', so it stays
>> uninitialized.
>
> But submodule.mod.path should only be set in .gitmodules, not in
> $GIT_DIR/config. Did you just remove the ignore setting from
> .gitmodules or the path too?
Just the ignore, and my patch of course.

If it is not set in $GIT_DIR/config, then config_name_for_path is not initialized, and if it is not initialized, then set_diffopt_flags_from_submodule_config does nothing (handle_ignore_submodules_arg is not called). That is the main problem.

- Orgad
Previous: Jens LehmannNext: Jens Lehmann
Message 12 of 14 in “commit: configure submodules”
  1. commit: configure submodulesOrgad Shaneh, Sep 23, 2012
  2. Junio C HamanoSep 23, 2012
  3. Jens LehmannSep 23, 2012
  4. Junio C HamanoSep 24, 2012
  5. Junio C HamanoSep 24, 2012
  6. Jens LehmannSep 24, 2012
  7. Junio C HamanoSep 24, 2012
  8. Orgad ShanehSep 24, 2012
  9. Junio C HamanoSep 24, 2012
  10. Orgad ShanehSep 24, 2012
  11. Jens LehmannSep 24, 2012
  12. Orgad ShanehSep 24, 2012
  13. Jens LehmannSep 24, 2012
  14. Junio C HamanoSep 24, 2012

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.