aboutsummaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2016-11-16 16:11:07 +0100
committerJunio C Hamano <gitster@pobox.com>2016-11-16 11:13:58 -0800
commit250ab24ab3a35d5857855a2e00483dcd8867fdca (patch)
treeeff16729348b57555474af3741b448fb0424feb1 /submodule.c
parent5b6607d23f8a262e1c0ede954f0477664934eed8 (diff)
downloadgit-250ab24ab3a35d5857855a2e00483dcd8867fdca.tar.gz
git-250ab24ab3a35d5857855a2e00483dcd8867fdca.tar.xz
submodule_needs_pushing(): explain the behaviour when we cannot answer
When we do not have commits that are involved in the update of the superproject in our copy of submodule, we cannot tell if the remote end needs to acquire these commits to be able to check out the superproject tree. Explain why we answer "no there is no need/point in pushing from our submodule repository" in this case. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 85287a1d1..b50948818 100644
--- a/submodule.c
+++ b/submodule.c
@@ -553,6 +553,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) {