All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, hvoigt@hvoigt.net,
	torvalds@linux-foundation.org, peff@peff.net
Subject: Re: [PATCHv4 2/2] push: change submodule default to check when submodules exist
Date: Thu, 06 Oct 2016 13:25:58 -0700	[thread overview]
Message-ID: <xmqqoa2xi5rd.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161006193725.31553-3-sbeller@google.com> (Stefan Beller's message of "Thu, 6 Oct 2016 12:37:25 -0700")

Stefan Beller <sbeller@google.com> writes:

> When working with submodules, it is easy to forget to push the submodules.
> The setting 'check', which checks if any existing submodule is present on
> at least one remote of the submodule remotes, is designed to prevent this
> mistake.
>
> Flipping the default to check for submodules is safer than the current
> default of ignoring submodules while pushing.
>
> However checking for submodules requires additional work[1], which annoys
> users that do not use submodules, so we turn on the check for submodules
> based on a cheap heuristic, the existence of the .git/modules directory.

... and other things like .gitmodules, submodule stuff in
.git/config, etc.?

> +	} else if (starts_with(k, "submodule.") && ends_with(k, ".url"))
> +		has_submodules_configured = 1;

An in-code comment to explain why ".url" is so special would be
helpful.  Documentation/config.txt says .path and .url are both
initially populated by 'git submodule init', which might be outdated
information that confuses readers of the above code.

> @@ -552,6 +564,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
>  	};
>  
>  	packet_trace_identity("push");
> +	preset_submodule_default();
>  	git_config(git_push_config, &flags);
>  	argc = parse_options(argc, argv, prefix, options, push_usage, 0);
>  	set_push_cert_flags(&flags, push_cert);
> diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
> index 198ce84..e690749 100755
> --- a/t/t5531-deep-submodule-push.sh
> +++ b/t/t5531-deep-submodule-push.sh
> @@ -65,7 +65,11 @@ test_expect_success 'push fails if submodule commit not on remote' '
>  		git add gar/bage &&
>  		git commit -m "Third commit for gar/bage" &&
>  		# the push should fail with --recurse-submodules=check
> -		# on the command line...
> +		# on the command line. "check" is the default for repos in
> +		# which submodules are detected by existence of config,
> +		# .gitmodules file or an internal .git/modules/<submodule-repo>
> +		git submodule add -f ../submodule.git gar/bage &&
> +		test_must_fail git push ../pub.git master &&
>  		test_must_fail git push --recurse-submodules=check ../pub.git master &&
>  
>  		# ...or if specified in the configuration..

  reply	other threads:[~2016-10-06 20:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 19:37 [PATCH 0/2] submodule pushes be extra careful Stefan Beller
2016-10-06 19:37 ` [PATCH 1/2] submodule add: extend force flag to add existing repos Stefan Beller
2016-10-06 20:11   ` Junio C Hamano
2016-10-07 12:52     ` Heiko Voigt
2016-10-07 17:25       ` Stefan Beller
2016-10-11 16:36         ` Heiko Voigt
2016-10-06 19:37 ` [PATCHv4 2/2] push: change submodule default to check when submodules exist Stefan Beller
2016-10-06 20:25   ` Junio C Hamano [this message]
2016-10-06 21:29     ` Stefan Beller
2016-10-06 23:41     ` [PATCHv5] " Stefan Beller

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=xmqqoa2xi5rd.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.