git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fredrik Gustafsson <iveqy@iveqy.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, iveqy@iveqy.com, jens.lehmann@web.de,
	hvoigt@hvoigt.net
Subject: [PATCH v2 3/3] push: Add the --no-recurse-submodules option
Date: Wed, 27 Jul 2011 20:10:50 +0200	[thread overview]
Message-ID: <1311790250-32454-4-git-send-email-iveqy@iveqy.com> (raw)
In-Reply-To: <1311790250-32454-1-git-send-email-iveqy@iveqy.com>

This adds the option --no-recurse-submodules to push. That is, git
will not check if the submodules are pushed. -f or --force still also
disables this check. Documentation is also updated.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 Documentation/git-push.txt     |    6 ++++++
 builtin/push.c                 |    1 +
 t/t5531-deep-submodule-push.sh |    7 +++++++
 transport.c                    |    4 +++-
 transport.h                    |    1 +
 5 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 88acfcd..d63a57c 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -113,6 +113,8 @@ nor in any Push line of the corresponding remotes file---see below).
 	not an ancestor of the local ref used to overwrite it.
 	This flag disables the check.  This can cause the
 	remote repository to lose commits; use it with care.
++
+	This also enforces --no-recurse-submodules
 
 --repo=<repository>::
 	This option is only relevant if no <repository> argument is
@@ -162,6 +164,10 @@ useful if you write an alias or script around 'git push'.
 	is specified. This flag forces progress status even if the
 	standard error stream is not directed to a terminal.
 
+--no-recurse-submodules::
+	Don't check if all submodule commits this repository refers to are
+	pushed to their remotes.
+
 include::urls-remotes.txt[]
 
 OUTPUT
diff --git a/builtin/push.c b/builtin/push.c
index 9cebf9e..07a8b11 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -236,6 +236,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		OPT_BIT('n' , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
 		OPT_BIT( 0,  "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN),
 		OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE),
+		OPT_BIT(0, "no-recurse-submodules", &flags, "do not recurse submodules", TRANSPORT_PUSH_NO_RECURSE_SUBMODULES),
 		OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),
 		OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", "receive pack program"),
 		OPT_STRING( 0 , "exec", &receivepack, "receive-pack", "receive pack program"),
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 15474c1..74c615c 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -124,4 +124,11 @@ test_expect_success 'push fails if submodule has no remote and is on the first s
 	)
 '
 
+test_expect_success 'push succeeds when --no-recurse-submodules is used' '
+	(
+		cd work &&
+		git push ../pub.git --no-recurse-submodules
+	)
+'
+
 test_done
diff --git a/transport.c b/transport.c
index e0fd435..9681560 100644
--- a/transport.c
+++ b/transport.c
@@ -1042,7 +1042,9 @@ int transport_push(struct transport *transport,
 			flags & TRANSPORT_PUSH_MIRROR,
 			flags & TRANSPORT_PUSH_FORCE);
 
-		if(!(flags & TRANSPORT_PUSH_FORCE) && !is_bare_repository()) {
+		if(!(flags & TRANSPORT_PUSH_NO_RECURSE_SUBMODULES) &&
+		   !(flags & TRANSPORT_PUSH_FORCE) &&
+		   !is_bare_repository()) {
 			struct ref *ref = remote_refs;
 			for (; ref; ref = ref->next)
 				if(!is_null_sha1(ref->new_sha1) && check_for_unpushed_submodule_commits(ref->new_sha1))
diff --git a/transport.h b/transport.h
index 161d724..c6ccf8c 100644
--- a/transport.h
+++ b/transport.h
@@ -101,6 +101,7 @@ struct transport {
 #define TRANSPORT_PUSH_MIRROR 8
 #define TRANSPORT_PUSH_PORCELAIN 16
 #define TRANSPORT_PUSH_SET_UPSTREAM 32
+#define TRANSPORT_PUSH_NO_RECURSE_SUBMODULES 64
 
 #define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
 
-- 
1.7.6.236.g7ad21

  parent reply	other threads:[~2011-07-27 18:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 18:10 [PATCH v2 0/3] check for unpushed remotes in submodules Fredrik Gustafsson
2011-07-27 18:10 ` [PATCH v2 1/3] test whether push checks " Fredrik Gustafsson
2011-07-27 18:10 ` [PATCH v2 2/3] push: Don't push a repository with unpushed submodules Fredrik Gustafsson
2011-07-27 18:10 ` Fredrik Gustafsson [this message]
2011-07-28 20:05   ` [PATCH v2 3/3] push: Add the --no-recurse-submodules option Junio C Hamano
2011-07-28 22:22     ` Jens Lehmann
2011-07-29 20:19     ` Jens Lehmann
2011-08-01  1:16       ` Junio C Hamano
2011-07-28 19:58 ` [PATCH v2 0/3] check for unpushed remotes in submodules Junio C Hamano
2011-07-28 22:14   ` Jens Lehmann
  -- strict thread matches above, loose matches on Subject: below --
2014-02-18 17:49 [PATCH v2 3/3] push: Add the --no-recurse-submodules option Semyon Perepelitsa
2014-02-20 13:12 ` Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311790250-32454-4-git-send-email-iveqy@iveqy.com \
    --to=iveqy@iveqy.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=jens.lehmann@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).