status/commit: show staged submodules regardless of ignore config

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to
"all" suppresses all output of submodule changes for the diff family,
status and commit. For status and commit this is really confusing, as it
even when the user chooses to record a new commit for an ignored submodule
by adding it manually this change won't show up under the to-be-committed
changes. To add insult to injury, a later "git commit" will error out with
"nothing to commit" when only ignored submodules are staged.

Fix that by making wt_status always print staged submodule changes, no
matter what ignore settings are configured. The only exception is when the
user explicitly uses the "--ignore-submodules=all" command line option, in
that case the submodule output is still suppressed. This also makes "git
commit" work again when only modifications of ignored submodules are
staged, as that command uses the "commitable" member of the wt_status
struct to determine if staged changes are present. But this only happens
when the commit command uses the wt_status* functions to produce status
output for human consumption (when forking an editor or with --dry-run),
in all other cases (e.g. when run in a script with '-m') another code path
is taken which uses index_differs_from() to determine if any changes are
staged which still ignores submodules according to their configuration.
This will be fixed in a follow-up commit.

Change t7508 to reflect this new behavior and add three new tests to show
that a single staged submodule configured to be ignored will be committed
when the status output is generated and won't be if not. Also update the
documentation of the ignore config options accordingly.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: bd4ff693f4c0c0983a7689597b4065d14bee07d0
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. gitk-git/
  8. gitweb/
  9. mergetools/
  10. perl/
  11. po/
  12. ppc/
  13. t/
  14. templates/
  15. vcs-svn/
  16. xdiff/
  17. .gitattributes
  18. .gitignore
  19. .mailmap
  20. abspath.c
  21. aclocal.m4
  22. advice.c
  23. advice.h
  24. alias.c
  25. alloc.c
  26. archive-tar.c
  27. archive-zip.c
  28. archive.c
  29. archive.h
  30. argv-array.c
  31. argv-array.h
  32. attr.c
  33. attr.h
  34. base85.c
  35. bisect.c
  36. bisect.h
  37. blob.c
  38. blob.h
  39. branch.c
  40. branch.h
  41. builtin.h
  42. bulk-checkin.c
  43. bulk-checkin.h
  44. bundle.c
  45. bundle.h
  46. cache-tree.c
  47. cache-tree.h
  48. cache.h
  49. check-builtins.sh
  50. check-racy.c
  51. check_bindir
  52. color.c
  53. color.h
  54. column.c
  55. column.h
  56. combine-diff.c
  57. command-list.txt
  58. commit-slab.h
  59. commit.c
  60. commit.h
  61. config.c
  62. config.mak.in
  63. config.mak.uname
  64. configure.ac
  65. connect.c
  66. connect.h
  67. connected.c
  68. connected.h
  69. convert.c
  70. convert.h
  71. copy.c
  72. COPYING
  73. credential-cache--daemon.c
  74. credential-cache.c
  75. credential-store.c
  76. credential.c
  77. credential.h
  78. csum-file.c
  79. csum-file.h
  80. ctype.c
  81. daemon.c
  82. date.c
  83. decorate.c
  84. decorate.h
  85. delta.h
  86. diff-delta.c
  87. diff-lib.c
  88. diff-no-index.c
  89. diff.c
  90. diff.h
  91. diffcore-break.c
  92. diffcore-delta.c
  93. diffcore-order.c
  94. diffcore-pickaxe.c
  95. diffcore-rename.c
  96. diffcore.h
  97. dir.c
  98. dir.h
  99. editor.c
  100. entry.c
  101. environment.c
  102. exec_cmd.c
  103. exec_cmd.h
  104. fast-import.c
  105. fetch-pack.c
  106. fetch-pack.h
  107. fmt-merge-msg.h
  108. fsck.c
  109. fsck.h
  110. generate-cmdlist.sh
  111. gettext.c
  112. gettext.h
  113. git-add--interactive.perl
  114. git-am.sh
  115. git-archimport.perl
  116. git-bisect.sh
  117. git-compat-util.h
  118. git-cvsexportcommit.perl
  119. git-cvsimport.perl
  120. git-cvsserver.perl
  121. git-difftool--helper.sh
  122. git-difftool.perl
  123. git-filter-branch.sh
  124. git-instaweb.sh
  125. git-merge-octopus.sh
  126. git-merge-one-file.sh
  127. git-merge-resolve.sh
  128. git-mergetool--lib.sh
  129. git-mergetool.sh
  130. git-p4.py
  131. git-parse-remote.sh
  132. git-pull.sh
  133. git-quiltimport.sh
  134. git-rebase--am.sh
  135. git-rebase--interactive.sh
  136. git-rebase--merge.sh
  137. git-rebase.sh
  138. git-relink.perl
  139. git-remote-testgit.sh
  140. git-request-pull.sh
  141. git-send-email.perl
  142. git-sh-i18n.sh
  143. git-sh-setup.sh
  144. git-stash.sh
  145. git-submodule.sh
  146. git-svn.perl
  147. GIT-VERSION-GEN
  148. git-web--browse.sh
  149. git.c
  150. git.rc
  151. git.spec.in
  152. gpg-interface.c
  153. gpg-interface.h
  154. graph.c
  155. graph.h
  156. grep.c
  157. grep.h
  158. hash.c
  159. hash.h
  160. help.c
  161. help.h
  162. hex.c
  163. http-backend.c
  164. http-fetch.c
  165. http-push.c
  166. http-walker.c
  167. http.c
  168. http.h
  169. ident.c
  170. imap-send.c
  171. INSTALL
  172. kwset.c
  173. kwset.h
  174. levenshtein.c
  175. levenshtein.h
  176. LGPL-2.1
  177. line-log.c
  178. line-log.h
  179. line-range.c
  180. line-range.h
  181. list-objects.c
  182. list-objects.h
  183. ll-merge.c
  184. ll-merge.h
  185. lockfile.c
  186. log-tree.c
  187. log-tree.h
  188. mailmap.c
  189. mailmap.h
  190. Makefile
  191. match-trees.c
  192. merge-blobs.c
  193. merge-blobs.h
  194. merge-recursive.c
  195. merge-recursive.h
  196. merge.c
  197. mergesort.c
  198. mergesort.h
  199. name-hash.c
  200. notes-cache.c
  201. notes-cache.h
  202. notes-merge.c
  203. notes-merge.h
  204. notes-utils.c
  205. notes-utils.h
  206. notes.c
  207. notes.h
  208. object.c
  209. object.h
  210. pack-check.c
  211. pack-revindex.c
  212. pack-revindex.h
  213. pack-write.c
  214. pack.h
  215. pager.c
  216. parse-options-cb.c
  217. parse-options.c
  218. parse-options.h
  219. patch-delta.c
  220. patch-ids.c
  221. patch-ids.h
  222. path.c
  223. pathspec.c
  224. pathspec.h
  225. pkt-line.c
  226. pkt-line.h
  227. preload-index.c
  228. pretty.c
  229. prio-queue.c
  230. prio-queue.h
  231. progress.c
  232. progress.h
  233. prompt.c
  234. prompt.h
  235. quote.c
  236. quote.h
  237. reachable.c
  238. reachable.h
  239. read-cache.c
  240. README
  241. reflog-walk.c
  242. reflog-walk.h
  243. refs.c
  244. refs.h
  245. remote-curl.c
  246. remote-testsvn.c
  247. remote.c
  248. remote.h
  249. replace_object.c
  250. rerere.c
  251. rerere.h
  252. resolve-undo.c
  253. resolve-undo.h
  254. revision.c
  255. revision.h
  256. run-command.c
  257. run-command.h
  258. send-pack.c
  259. send-pack.h
  260. sequencer.c
  261. sequencer.h
  262. server-info.c
  263. setup.c
  264. sh-i18n--envsubst.c
  265. sha1-array.c
  266. sha1-array.h
  267. sha1-lookup.c
  268. sha1-lookup.h
  269. sha1_file.c
  270. sha1_name.c
  271. shallow.c
  272. shell.c
  273. shortlog.h
  274. show-index.c
  275. sideband.c
  276. sideband.h
  277. sigchain.c
  278. sigchain.h
  279. strbuf.c
  280. strbuf.h
  281. streaming.c
  282. streaming.h
  283. string-list.c
  284. string-list.h
  285. submodule.c
  286. submodule.h
  287. symlinks.c
  288. tag.c
  289. tag.h
  290. tar.h
  291. test-chmtime.c
  292. test-ctype.c
  293. test-date.c
  294. test-delta.c
  295. test-dump-cache-tree.c
  296. test-genrandom.c
  297. test-index-version.c
  298. test-line-buffer.c
  299. test-match-trees.c
  300. test-mergesort.c
  301. test-mktemp.c
  302. test-parse-options.c
  303. test-path-utils.c
  304. test-prio-queue.c
  305. test-read-cache.c
  306. test-regex.c
  307. test-revision-walking.c
  308. test-run-command.c
  309. test-scrap-cache-tree.c
  310. test-sha1.c
  311. test-sha1.sh
  312. test-sigchain.c
  313. test-string-list.c
  314. test-subprocess.c
  315. test-svn-fe.c
  316. test-urlmatch-normalization.c
  317. test-wildmatch.c
  318. thread-utils.c
  319. thread-utils.h
  320. trace.c
  321. transport-helper.c
  322. transport.c
  323. transport.h
  324. tree-diff.c
  325. tree-walk.c
  326. tree-walk.h
  327. tree.c
  328. tree.h
  329. unimplemented.sh
  330. unix-socket.c
  331. unix-socket.h
  332. unpack-trees.c
  333. unpack-trees.h
  334. upload-pack.c
  335. url.c
  336. url.h
  337. urlmatch.c
  338. urlmatch.h
  339. usage.c
  340. userdiff.c
  341. userdiff.h
  342. utf8.c
  343. utf8.h
  344. varint.c
  345. varint.h
  346. version.c
  347. version.h
  348. walker.c
  349. walker.h
  350. wildmatch.c
  351. wildmatch.h
  352. wrap-for-bin.sh
  353. wrapper.c
  354. write_or_die.c
  355. ws.c
  356. wt-status.c
  357. wt-status.h
  358. xdiff-interface.c
  359. xdiff-interface.h
  360. zlib.c