git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] transport submodules: correct error message
@ 2017-01-13 23:54 Stefan Beller
  2017-01-17 23:42 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Beller @ 2017-01-13 23:54 UTC (permalink / raw)
  To: gitster; +Cc: git, hvoigt, dborowitz, Stefan Beller

When push.recurseSubmodules is set to "check" or "on-demand", the transport
layer tries to determine if a submodule needs pushing. This check is done
by walking all remote refs that are known.

For remotes we only store the refs/heads/* (and tags), which doesn't
include all commits. In e.g. Gerrit commits often end up at refs/changes/*
(that we do not store) when pushing to refs/for/master (which we also do
not store). So a workflow such as the following still fails:

    $ git -C <submodule> push origin HEAD:refs/for/master
    $ git push origin HEAD:refs/for/master
    The following submodule paths contain changes that can
    not be found on any remote:
      submodule

    Please try

        git push --recurse-submodules=on-demand

    or cd to the path and use

        git push

    to push them to a remote.

Trying to push with --recurse-submodules=on-demand would run into
the same problem. To fix this issue
    1) specifically mention that we looked for branches on the remote.
    2) advertise pushing without recursing into submodules. ("Use this
       command to make the error message go away")

While at it, remove some empty lines, as they blow up the error message.

Reported-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 transport.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/transport.c b/transport.c
index 3e8799a611..2445bf0dca 100644
--- a/transport.c
+++ b/transport.c
@@ -883,14 +883,14 @@ static void die_with_unpushed_submodules(struct string_list *needs_pushing)
 	int i;
 
 	fprintf(stderr, _("The following submodule paths contain changes that can\n"
-			"not be found on any remote:\n"));
+			"not be found on any remote branch:\n"));
 	for (i = 0; i < needs_pushing->nr; i++)
 		fprintf(stderr, "  %s\n", needs_pushing->items[i].string);
-	fprintf(stderr, _("\nPlease try\n\n"
-			  "	git push --recurse-submodules=on-demand\n\n"
-			  "or cd to the path and use\n\n"
-			  "	git push\n\n"
-			  "to push them to a remote.\n\n"));
+	fprintf(stderr, _("\nSuppress submodule checks via\n"
+			  "	git push --no-recurse-submodules\n"
+			  "or cd to the path and use\n"
+			  "	git push\n"
+			  "to push them to a remote.\n"));
 
 	string_list_clear(needs_pushing, 0);
 
-- 
2.11.0.297.g298debce27


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-18  0:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 23:54 [PATCH] transport submodules: correct error message Stefan Beller
2017-01-17 23:42 ` Junio C Hamano
2017-01-18  0:08   ` Stefan Beller
2017-01-18  0:15     ` Junio C Hamano
2017-01-18  0:21       ` Stefan Beller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).