transport.c: remove implicit dependency on the_index

note, there's still another hidden dependency related to this: even though we pass a repo to transport_push() we still use is_bare_repository() which pretty much assumes the_repository (and some other global state). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 10, 2018 at 06:48 UTC 6c6d5d0776b5eb60dc206691fc1fde755e94da20
3 files changed +8 -5
builtin/push.c
+2 -1
@@ -355,7 +355,8 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
355
356 if (verbosity > 0)
357 fprintf(stderr, _("Pushing to %s\n"), transport->url);
358 - err = transport_push(transport, rs, flags, &reject_reasons);
358 + err = transport_push(the_repository, transport,
359 + rs, flags, &reject_reasons);
360 if (err != 0) {
361 fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
362 error(_("failed to push some refs to '%s'"), transport->url);
transport.c
+4 -3
@@ -1105,7 +1105,8 @@ static int run_pre_push_hook(struct transport *transport,
1105 return ret;
1106 }
1107
1108 -int transport_push(struct transport *transport,
1108 +int transport_push(struct repository *r,
1109 + struct transport *transport,
1110 struct refspec *rs, int flags,
1111 unsigned int *reject_reasons)
1112 {
@@ -1172,7 +1173,7 @@ int transport_push(struct transport *transport,
1173 oid_array_append(&commits,
1174 &ref->new_oid);
1175
1175 - if (!push_unpushed_submodules(the_repository,
1176 + if (!push_unpushed_submodules(r,
1177 &commits,
1178 transport->remote,
1179 rs,
@@ -1197,7 +1198,7 @@ int transport_push(struct transport *transport,
1198 oid_array_append(&commits,
1199 &ref->new_oid);
1200
1200 - if (find_unpushed_submodules(the_repository,
1201 + if (find_unpushed_submodules(r,
1202 &commits,
1203 transport->remote->name,
1204 &needs_pushing)) {
transport.h
+2 -1
@@ -223,7 +223,8 @@ void transport_set_verbosity(struct transport *transport, int verbosity,
223 #define REJECT_FETCH_FIRST 0x08
224 #define REJECT_NEEDS_FORCE 0x10
225
226 -int transport_push(struct transport *connection,
226 +int transport_push(struct repository *repo,
227 + struct transport *connection,
228 struct refspec *rs, int flags,
229 unsigned int * reject_reasons);
230