fetch/pull: Add the --recurse-submodules option

Until now you had to call "git submodule update" (without -N|--no-fetch
option) or something like "git submodule foreach git fetch" to fetch
new commits in populated submodules from their remote.

This could lead to "(commits not present)" messages in the output of
"git diff --submodule" (which is used by "git gui" and "gitk") after
fetching or pulling new commits in the superproject and is an obstacle for
implementing recursive checkout of submodules. Also "git submodule
update" cannot fetch changes when disconnected, so it was very easy to
forget to fetch the submodule changes before disconnecting only to
discover later that they are needed.

This patch adds the "--recurse-submodules" option to recursively fetch
each populated submodule from the url configured in the .git/config of the
submodule at the end of each "git fetch" or during "git pull" in the
superproject. The submodule paths are taken from the index.

The hidden option "--submodule-prefix" is added to "git fetch" to be able
to print out the full paths of nested submodules.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 files changed
tree: 4e26a11bba6c571c41fef1e625f61edfa62cbb12
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. perl/
  11. ppc/
  12. t/
  13. templates/
  14. xdiff/
  15. .gitattributes
  16. .gitignore
  17. .mailmap
  18. abspath.c
  19. aclocal.m4
  20. advice.c
  21. advice.h
  22. alias.c
  23. alloc.c
  24. archive-tar.c
  25. archive-zip.c
  26. archive.c
  27. archive.h
  28. attr.c
  29. attr.h
  30. base85.c
  31. bisect.c
  32. bisect.h
  33. blob.c
  34. blob.h
  35. branch.c
  36. branch.h
  37. builtin.h
  38. bundle.c
  39. bundle.h
  40. cache-tree.c
  41. cache-tree.h
  42. cache.h
  43. check-builtins.sh
  44. check-racy.c
  45. check_bindir
  46. color.c
  47. color.h
  48. combine-diff.c
  49. command-list.txt
  50. commit.c
  51. commit.h
  52. config.c
  53. config.mak.in
  54. configure.ac
  55. connect.c
  56. convert.c
  57. copy.c
  58. COPYING
  59. csum-file.c
  60. csum-file.h
  61. ctype.c
  62. daemon.c
  63. date.c
  64. decorate.c
  65. decorate.h
  66. delta.h
  67. diff-delta.c
  68. diff-lib.c
  69. diff-no-index.c
  70. diff.c
  71. diff.h
  72. diffcore-break.c
  73. diffcore-delta.c
  74. diffcore-order.c
  75. diffcore-pickaxe.c
  76. diffcore-rename.c
  77. diffcore.h
  78. dir.c
  79. dir.h
  80. editor.c
  81. entry.c
  82. environment.c
  83. exec_cmd.c
  84. exec_cmd.h
  85. fast-import.c
  86. fetch-pack.h
  87. fixup-builtins
  88. fsck.c
  89. fsck.h
  90. generate-cmdlist.sh
  91. git-add--interactive.perl
  92. git-am.sh
  93. git-archimport.perl
  94. git-bisect.sh
  95. git-compat-util.h
  96. git-cvsexportcommit.perl
  97. git-cvsimport.perl
  98. git-cvsserver.perl
  99. git-difftool--helper.sh
  100. git-difftool.perl
  101. git-filter-branch.sh
  102. git-instaweb.sh
  103. git-lost-found.sh
  104. git-merge-octopus.sh
  105. git-merge-one-file.sh
  106. git-merge-resolve.sh
  107. git-mergetool--lib.sh
  108. git-mergetool.sh
  109. git-parse-remote.sh
  110. git-pull.sh
  111. git-quiltimport.sh
  112. git-rebase--interactive.sh
  113. git-rebase.sh
  114. git-relink.perl
  115. git-remote-testgit.py
  116. git-repack.sh
  117. git-request-pull.sh
  118. git-send-email.perl
  119. git-sh-setup.sh
  120. git-stash.sh
  121. git-submodule.sh
  122. git-svn.perl
  123. GIT-VERSION-GEN
  124. git-web--browse.sh
  125. git.c
  126. git.spec.in
  127. graph.c
  128. graph.h
  129. grep.c
  130. grep.h
  131. hash.c
  132. hash.h
  133. help.c
  134. help.h
  135. hex.c
  136. http-backend.c
  137. http-fetch.c
  138. http-push.c
  139. http-walker.c
  140. http.c
  141. http.h
  142. ident.c
  143. imap-send.c
  144. INSTALL
  145. levenshtein.c
  146. levenshtein.h
  147. list-objects.c
  148. list-objects.h
  149. ll-merge.c
  150. ll-merge.h
  151. lockfile.c
  152. log-tree.c
  153. log-tree.h
  154. mailmap.c
  155. mailmap.h
  156. Makefile
  157. match-trees.c
  158. merge-file.c
  159. merge-recursive.c
  160. merge-recursive.h
  161. name-hash.c
  162. notes-cache.c
  163. notes-cache.h
  164. notes.c
  165. notes.h
  166. object.c
  167. object.h
  168. pack-check.c
  169. pack-refs.c
  170. pack-refs.h
  171. pack-revindex.c
  172. pack-revindex.h
  173. pack-write.c
  174. pack.h
  175. pager.c
  176. parse-options.c
  177. parse-options.h
  178. patch-delta.c
  179. patch-ids.c
  180. patch-ids.h
  181. path.c
  182. pkt-line.c
  183. pkt-line.h
  184. preload-index.c
  185. pretty.c
  186. progress.c
  187. progress.h
  188. quote.c
  189. quote.h
  190. reachable.c
  191. reachable.h
  192. read-cache.c
  193. README
  194. reflog-walk.c
  195. reflog-walk.h
  196. refs.c
  197. refs.h
  198. remote-curl.c
  199. remote.c
  200. remote.h
  201. replace_object.c
  202. rerere.c
  203. rerere.h
  204. resolve-undo.c
  205. resolve-undo.h
  206. revision.c
  207. revision.h
  208. run-command.c
  209. run-command.h
  210. send-pack.h
  211. server-info.c
  212. setup.c
  213. sha1-lookup.c
  214. sha1-lookup.h
  215. sha1_file.c
  216. sha1_name.c
  217. shallow.c
  218. shell.c
  219. shortlog.h
  220. show-index.c
  221. sideband.c
  222. sideband.h
  223. sigchain.c
  224. sigchain.h
  225. strbuf.c
  226. strbuf.h
  227. string-list.c
  228. string-list.h
  229. submodule.c
  230. submodule.h
  231. symlinks.c
  232. tag.c
  233. tag.h
  234. tar.h
  235. test-chmtime.c
  236. test-ctype.c
  237. test-date.c
  238. test-delta.c
  239. test-dump-cache-tree.c
  240. test-genrandom.c
  241. test-index-version.c
  242. test-match-trees.c
  243. test-parse-options.c
  244. test-path-utils.c
  245. test-run-command.c
  246. test-sha1.c
  247. test-sha1.sh
  248. test-sigchain.c
  249. thread-utils.c
  250. thread-utils.h
  251. trace.c
  252. transport-helper.c
  253. transport.c
  254. transport.h
  255. tree-diff.c
  256. tree-walk.c
  257. tree-walk.h
  258. tree.c
  259. tree.h
  260. unimplemented.sh
  261. unpack-trees.c
  262. unpack-trees.h
  263. upload-pack.c
  264. url.c
  265. url.h
  266. usage.c
  267. userdiff.c
  268. userdiff.h
  269. utf8.c
  270. utf8.h
  271. walker.c
  272. walker.h
  273. wrap-for-bin.sh
  274. wrapper.c
  275. write_or_die.c
  276. ws.c
  277. wt-status.c
  278. wt-status.h
  279. xdiff-interface.c
  280. xdiff-interface.h