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

Re: [PATCH 3/3] Fixes bug: GIT_PS1_SHOWDIRTYSTATE is no not respect diff.ignoreSubmodules config variable

From
Jens Lehmann <jens.lehmann@web.de>
Date
Dec 25, 2010, 12:33 UTC
Message-ID
<4D15E48A.9050805@web.de>
In-Reply-To
<1293240049-7744-3-git-send-email-zapped@mail.ru>
Am 25.12.2010 02:20, schrieb Zapped:
Show 19 quoted lines
> Signed-off-by: Zapped <zapped@mail.ru>
> ---
>  contrib/completion/git-completion.bash |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index d3037fc..50fc385 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -280,7 +280,8 @@ __git_ps1 ()
>  		elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
>  			if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
>  				if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
> -					git diff --no-ext-diff --quiet --exit-code || w="*"
> +					is=$(git config diff.ignoreSubmodules)
> +					git diff --no-ext-diff --quiet --exit-code --ignore-submodules=$is || w="*"
>  					if git rev-parse --quiet --verify HEAD >/dev/null; then
>  						git diff-index --cached --quiet HEAD -- || i="+"
>  					else

Thanks for resubmitting this as an inline patch for review (although it would have been easier for me if the commit message would have described the problem you tried to fix a bit more in detail ;-).

After testing this patch it looks like it has a few issues:
1) it will break any per-submodule configuration done via
   the 'submodule.<name>.ignore' setting in .git/config or
   .gitmodules, as using the --ignore-submodules option
   overrides those while only setting 'diff.ignoreSubmodules'
   should not do that.
2) If diff.ignoreSubmodules is unset it leads to an error
   every time the prompt is displayed:
   'fatal: bad --ignore-submodules argument:'
3) And for me it didn't change the behavior at all:
   - The '*' in the prompt vanishes as I set diff.ignoreSubmodules
     as expected with or without your patch.
     Am I missing something here?
   - The real problem here is that the '+' never goes away even
     when 'diff.ignoreSubmodules' is set to 'all'. This is due
     to the fact that 'diff.ignoreSubmodules' is only honored by
     "git diff", but not by "git diff-index".

So the real issue here seems to be the "git diff-index" call, which doesn't honor the 'diff.ignoreSubmodules' setting. In commit 37aea37 Dscho (CCed) introduced this configuration setting while explicitly stating that it only affects porcelain. As the other config options always influence porcelain and plumbing, it looks like we would want to have this option honored by plumbing too, no?

So are there any reasons for the plumbing diff commands not to honor the diff.ignoreSubmodules setting?

Previous: ZappedNext: Johannes Schindelin
Message 8 of 20 in “Fixes bug: git-diff: class methods are not detected in hunk headers for Pascal”
  1. 1/3 Fixes bug: git-diff: class methods are not detected in hunk headers for PascalZapped, Dec 25, 2010
  2. 2/3 Fixes bug: git-svn: svn.pathnameencoding is not respected with dcommit/set-treeZapped, Dec 25, 2010
  3. Thomas RastJan 4, 2011
  4. Eric WongJan 4, 2011
  5. Alexey ShumkinFeb 3, 2011
  6. Re[2]: [PATCH 2/3] Fixes bug: git-svn: svn.pathnameencoding is not respected with dcommit/set-treeАлексей Шумкин, Jan 5, 2011
  7. 3/3 Fixes bug: GIT_PS1_SHOWDIRTYSTATE is no not respect diff.ignoreSubmodules config variableZapped, Dec 25, 2010
  8. Jens LehmannDec 25, 2010
  9. Johannes SchindelinDec 25, 2010
  10. Junio C HamanoDec 26, 2010
  11. Re[2]: [PATCH 3/3] Fixes bug: GIT_PS1_SHOWDIRTYSTATE is no not respect diff.ignoreSubmodules config variableАлексей Шумкин, Dec 26, 2010
  12. Jens LehmannDec 27, 2010
  13. Johannes SchindelinDec 27, 2010
  14. Casey DahlinDec 27, 2010
  15. Re[2]: [PATCH 3/3] Fixes bug: GIT_PS1_SHOWDIRTYSTATE is no not respect diff.ignoreSubmodules config variableАлексей Крезов, Dec 26, 2010
  16. Re[2]: [PATCH 3/3] Fixes bug: GIT_PS1_SHOWDIRTYSTATE is no not respect diff.ignoreSubmodules config variableАлексей Шумкин, Dec 28, 2010
  17. Thomas RastJan 4, 2011
  18. Re[2]: [PATCH 1/3] Fixes bug: git-diff: class methods are not detected in hunk headers for PascalАлексей Шумкин, Jan 5, 2011
  19. Thomas RastJan 5, 2011
  20. Thomas RastJan 5, 2011

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.