fetch/pull: Don't recurse into a submodule when commits are already present

When looking for submodules where new commits have been recorded in the
superproject ignore those cases where the submodules commits are already
present locally. This can happen e.g. when the submodule has been rewound
to an earlier state. Then there is no need to fetch the submodule again
as the commit recorded in the newly fetched superproject commit has
already been fetched earlier into the submodule.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index d287028..39d326a 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -73,7 +73,8 @@
 	'yes', which is the default when this option is used without any
 	value. Use 'on-demand' to only recurse into a populated submodule
 	when the superproject retrieves a commit that updates the submodule's
-	reference.
+	reference to a commit that isn't already in the local submodule
+	clone.
 
 --no-recurse-submodules::
 	Disable recursive fetching of submodules (this has the same effect as