Skip to content

Commit 6c6d5d0

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 878d832 commit 6c6d5d0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

builtin/push.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
355355

356356
if (verbosity > 0)
357357
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);
359360
if (err != 0) {
360361
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
361362
error(_("failed to push some refs to '%s'"), transport->url);

transport.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,8 @@ static int run_pre_push_hook(struct transport *transport,
11051105
return ret;
11061106
}
11071107

1108-
int transport_push(struct transport *transport,
1108+
int transport_push(struct repository *r,
1109+
struct transport *transport,
11091110
struct refspec *rs, int flags,
11101111
unsigned int *reject_reasons)
11111112
{
@@ -1172,7 +1173,7 @@ int transport_push(struct transport *transport,
11721173
oid_array_append(&commits,
11731174
&ref->new_oid);
11741175

1175-
if (!push_unpushed_submodules(the_repository,
1176+
if (!push_unpushed_submodules(r,
11761177
&commits,
11771178
transport->remote,
11781179
rs,
@@ -1197,7 +1198,7 @@ int transport_push(struct transport *transport,
11971198
oid_array_append(&commits,
11981199
&ref->new_oid);
11991200

1200-
if (find_unpushed_submodules(the_repository,
1201+
if (find_unpushed_submodules(r,
12011202
&commits,
12021203
transport->remote->name,
12031204
&needs_pushing)) {

transport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ void transport_set_verbosity(struct transport *transport, int verbosity,
223223
#define REJECT_FETCH_FIRST 0x08
224224
#define REJECT_NEEDS_FORCE 0x10
225225

226-
int transport_push(struct transport *connection,
226+
int transport_push(struct repository *repo,
227+
struct transport *connection,
227228
struct refspec *rs, int flags,
228229
unsigned int * reject_reasons);
229230

0 commit comments

Comments
 (0)