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

[PATCH v4 4/4] submodule_needs_pushing() NEEDSWORK when we can not answer this question

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Nov 16, 2016, 15:11 UTC
Message-ID
<9c95594f73625e06374f323fa5dc7d6487aa0356.1479308877.git.hvoigt@hvoigt.net>
In-Reply-To
<cover.1479308877.git.hvoigt@hvoigt.net>
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 submodule.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/submodule.c b/submodule.c
index 11391fa..00dd655 100644
--- a/submodule.c
+++ b/submodule.c
@@ -531,6 +531,17 @@ static int submodule_has_commits(const char *path, struct sha1_array *commits)
 static int submodule_needs_pushing(const char *path, struct sha1_array *commits)
 {
 	if (!submodule_has_commits(path, commits))
+		/*
+		 * NOTE: We do consider it safe to return "no" here. The
+		 * correct answer would be "We do not know" instead of
+		 * "No push needed", but it is quite hard to change
+		 * the submodule pointer without having the submodule
+		 * around. If a user did however change the submodules
+		 * without having the submodule around, this indicates
+		 * an expert who knows what they are doing or a
+		 * maintainer integrating work from other people. In
+		 * both cases it should be safe to skip this check.
+		 */
 		return 0;
 
 	if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) {
-- 
2.10.1.386.gc503e45
Previous: Heiko VoigtNext: Junio C Hamano
Message 3 of 8 in “Speedup finding of unpushed submodules”
  1. 0/4 Speedup finding of unpushed submodulesHeiko Voigt, Nov 16, 2016
  2. 1/4 serialize collection of changed submodulesHeiko Voigt, Nov 16, 2016
  3. 4/4 submodule_needs_pushing() NEEDSWORK when we can not answer this questionHeiko Voigt, Nov 16, 2016
  4. Junio C HamanoNov 16, 2016
  5. Heiko VoigtNov 16, 2016
  6. 2/4 serialize collection of refs that contain submodule changesHeiko Voigt, Nov 16, 2016
  7. 3/4 batch check whether submodule needs pushing into one callHeiko Voigt, Nov 16, 2016
  8. Stefan BellerNov 17, 2016

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.