From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: bmwill@google.com, git@vger.kernel.org, larsxschneider@gmail.com,
sbeller@google.com
Subject: [PATCH] pull: respect submodule update configuration
Date: Fri, 18 Aug 2017 15:04:31 -0700 [thread overview]
Message-ID: <20170818220431.22157-1-sbeller@google.com> (raw)
In-Reply-To: <xmqqpobsbsk1.fsf@gitster.mtv.corp.google.com>
From: Lars Schneider <larsxschneider@gmail.com>
Do not override the submodule configuration in the call to update
the submodules, but give a weaker default.
Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
Personally I dislike this patch, but I have no better idea for the time
being.
Thanks,
Stefan
builtin/pull.c | 6 ++++--
git-submodule.sh | 7 ++++++-
t/t7400-submodule-basic.sh | 22 ++++++++++++++++++++++
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index 9b86e519b1..be4f74d764 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -553,7 +553,8 @@ static int rebase_submodules(void)
cp.git_cmd = 1;
cp.no_stdin = 1;
argv_array_pushl(&cp.args, "submodule", "update",
- "--recursive", "--rebase", NULL);
+ "--recursive", "--default-update",
+ "rebase", NULL);
return run_command(&cp);
}
@@ -565,7 +566,8 @@ static int update_submodules(void)
cp.git_cmd = 1;
cp.no_stdin = 1;
argv_array_pushl(&cp.args, "submodule", "update",
- "--recursive", "--checkout", NULL);
+ "--recursive", "--default-update",
+ "checkout", NULL);
return run_command(&cp);
}
diff --git a/git-submodule.sh b/git-submodule.sh
index e131760eec..6dbc32e686 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -511,6 +511,7 @@ fetch_in_submodule () (
cmd_update()
{
# parse $args after "submodule ... update".
+ default_update="checkout"
while test $# -ne 0
do
case "$1" in
@@ -552,6 +553,10 @@ cmd_update()
--checkout)
update="checkout"
;;
+ --default-update)
+ default_update="$2"
+ shift
+ ;;
--recommend-shallow)
recommend_shallow="--recommend-shallow"
;;
@@ -619,7 +624,7 @@ cmd_update()
update_module=$(git config submodule."$name".update)
if test -z "$update_module"
then
- update_module="checkout"
+ update_module="$default_update"
fi
fi
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index dcac364c5f..ff64bf8528 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1289,4 +1289,26 @@ test_expect_success 'init properly sets the config' '
test_must_fail git -C multisuper_clone config --get submodule.sub1.active
'
+test_expect_success 'submodule update and git pull with disabled submodule' '
+ test_when_finished "rm -rf multisuper_clone" &&
+ pwd=$(pwd) &&
+ cat <<-\EOF >expect &&
+ -sub0
+ sub1 (test2)
+ sub2 (test2)
+ sub3 (test2)
+ sub4 (test2)
+ sub5 (test2)
+ EOF
+ git clone file://"$pwd"/multisuper multisuper_clone &&
+ (
+ cd multisuper_clone &&
+ git config --local submodule.sub0.update none &&
+ git submodule update --init --recursive &&
+ git pull --recurse-submodules &&
+ git submodule status | cut -c 1,43- >actual
+ ) &&
+ test_cmp expect multisuper_clone/actual
+'
+
test_done
--
2.14.0.rc0.3.g6c2e499285
next prev parent reply other threads:[~2017-08-18 22:04 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 18:35 Submodule regression in 2.14? Lars Schneider
2017-08-16 18:51 ` Stefan Beller
2017-08-16 18:53 ` Stefan Beller
2017-08-17 21:21 ` Lars Schneider
2017-08-17 21:55 ` Stefan Beller
2017-08-18 2:13 ` Junio C Hamano
2017-08-18 4:02 ` Stefan Beller
2017-08-18 16:50 ` Junio C Hamano
2017-08-18 19:09 ` Stefan Beller
2017-08-19 6:51 ` Junio C Hamano
2017-08-21 16:05 ` Heiko Voigt
2017-08-21 16:42 ` Stefan Beller
2017-08-22 15:33 ` Heiko Voigt
2017-08-22 18:10 ` Stefan Beller
2017-08-25 9:10 ` Heiko Voigt
2017-08-25 16:38 ` Stefan Beller
2017-08-25 16:53 ` Junio C Hamano
2017-08-21 16:48 ` Junio C Hamano
2017-08-22 15:50 ` Heiko Voigt
2017-08-21 16:46 ` Stefan Beller
2017-08-21 22:45 ` Junio C Hamano
2017-08-18 13:12 ` Lars Schneider
2017-08-18 17:16 ` Stefan Beller
2017-08-18 19:10 ` Junio C Hamano
2017-08-18 22:04 ` Stefan Beller [this message]
2017-08-18 22:05 ` [PATCH] pull: respect submodule update configuration Stefan Beller
2017-08-19 6:17 ` Junio C Hamano
2017-08-19 6:24 ` Junio C Hamano
2017-08-21 16:20 ` Heiko Voigt
2017-08-21 16:55 ` Stefan Beller
2017-08-21 17:20 ` Lars Schneider
2017-08-21 17:48 ` Stefan Beller
2017-08-21 18:21 ` Brandon Williams
2017-08-21 22:52 ` Junio C Hamano
2017-08-22 14:50 ` Lars Schneider
2017-08-22 17:51 ` Stefan Beller
2017-08-22 18:55 ` Brandon Williams
2017-08-19 18:24 ` Submodule regression in 2.14? Lars Schneider
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170818220431.22157-1-sbeller@google.com \
--to=sbeller@google.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=larsxschneider@gmail.com \
/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.
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).