builtin/push.c: respect 'submodule.recurse' option
The closest mapping from the boolean 'submodule.recurse' set to "yes" to the variety of submodule push modes is "on-demand", so implement that. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
May 31, 2017 at 17:30 UTC
4e53d6a54122b6034b9b0346c84e3e5525aed542
2 files changed
+25
builtin/push.c
+4
@@ -498,6 +498,10 @@ static int git_push_config(const char *k, const char *v, void *cb)
498
const char *value;
499
if (!git_config_get_value("push.recursesubmodules", &value))
500
recurse_submodules = parse_push_recurse_submodules_arg(k, value);
501
+ } else if (!strcmp(k, "submodule.recurse")) {
502
+ int val = git_config_bool(k, v) ?
503
+ RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF;
504
+ recurse_submodules = val;
505
}
506
507
return git_default_config(k, v, NULL);
t/t5531-deep-submodule-push.sh
+21
@@ -126,6 +126,27 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
126
)
127
'
128
129
+test_expect_success 'push succeeds if submodule commit not on remote but using auto-on-demand via submodule.recurse config' '
130
+ (
131
+ cd work/gar/bage &&
132
+ >recurse-on-demand-from-submodule-recurse-config &&
133
+ git add recurse-on-demand-from-submodule-recurse-config &&
134
+ git commit -m "Recurse submodule.recurse from config junk"
135
+ ) &&
136
+ (
137
+ cd work &&
138
+ git add gar/bage &&
139
+ git commit -m "Recurse submodule.recurse from config for gar/bage" &&
140
+ git -c submodule.recurse push ../pub.git master &&
141
+ # Check that the supermodule commit got there
142
+ git fetch ../pub.git &&
143
+ git diff --quiet FETCH_HEAD master &&
144
+ # Check that the submodule commit got there too
145
+ cd gar/bage &&
146
+ git diff --quiet origin/master master
147
+ )
148
+'
149
+
150
test_expect_success 'push recurse-submodules on command line overrides config' '
151
(
152
cd work/gar/bage &&