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

Nested submodule status bug

From
DRDamien Robert <damien.olivier.robert@gmail.com>
Date
Feb 26, 2020, 17:23 UTC
Message-ID
<20200226172338.unembhjhog36sqj7@mithrim>
In-Reply-To
<0123F1ED-C421-4C1F-896B-E54C9D345A34@gmail.com>
Dear git developers,

still about nested submodules, I stumbled upon the following very strange behaviour.

1) Make a baz submodule inside a bar submodule inside foo
  mkdir foo; cd foo; git init
  mkdir bar; cd bar; git init
  mkdir baz; cd baz; git init
  touch 1
  git add 1
  git commit -m 'first baz commit'
  cd ..
  git submodule add ./baz
  git commit -m "Add baz submodule"
  cd ..
  git submodule add ./bar
  git commit -m "Add bar submodule\n"
  git submodule absorbgitdirs
  cd bar
  touch 2
2) Now add the following alias:
  subs="! git -C baz status"
3) And run it
  git subs
To get:
~~~
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	../2

nothing added to commit but untracked files present (use "git add" to track) ~~~

While when not launched as an alias, `git -C baz status` give the correct result: On branch master nothing to commit, working tree clean

Note: I get the same bug when I use
  subs="! sh -c 'cd baz; git status'"
The bug is only there if absorbgitdirs is used. Also I have to be in an
intermediate submodule.

Best regards, Damien

Previous: Philippe BlainNext: Damien Robert
Message 5 of 13 in “Nested submodule checkout”
  1. Damien RobertFeb 14, 2020
  2. Philippe BlainFeb 17, 2020
  3. Damien RobertFeb 18, 2020
  4. Philippe BlainFeb 19, 2020
  5. Nested submodule status bugDamien Robert, Feb 26, 2020
  6. Damien RobertFeb 27, 2020
  7. Spurious GIT_DIR set when in a worktree [was Re: Nested submodule status bug]Damien Robert, Feb 27, 2020
  8. GIT_DIR in aliases [Re: Spurious GIT_DIR set when in a worktree [was Re: Nested submodule status bug]Damien Robert, Feb 27, 2020
  9. Jeff KingFeb 28, 2020
  10. Junio C HamanoFeb 28, 2020
  11. Damien RobertMar 3, 2020
  12. Philippe BlainFeb 29, 2020
  13. Damien RobertMar 3, 2020

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.