summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-11-10 05:48:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-12 05:50:05 (GMT)
commit6c6d5d0776b5eb60dc206691fc1fde755e94da20 (patch)
treed004a57dadff0d37a6a4c9ca8c7cbc62f41a0394
parent878d832938100a0c4efc8373b782e086d2aae3cb (diff)
downloadgit-6c6d5d0776b5eb60dc206691fc1fde755e94da20.zip
git-6c6d5d0776b5eb60dc206691fc1fde755e94da20.tar.gz
git-6c6d5d0776b5eb60dc206691fc1fde755e94da20.tar.bz2
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>
-rw-r--r--builtin/push.c3
-rw-r--r--transport.c7
-rw-r--r--transport.h3
3 files changed, 8 insertions, 5 deletions
diff --git a/builtin/push.c b/builtin/push.c
index d09a420..efb3e38 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -355,7 +355,8 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
if (verbosity > 0)
fprintf(stderr, _("Pushing to %s\n"), transport->url);
- err = transport_push(transport, rs, flags, &reject_reasons);
+ err = transport_push(the_repository, transport,
+ rs, flags, &reject_reasons);
if (err != 0) {
fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
error(_("failed to push some refs to '%s'"), transport->url);
diff --git a/transport.c b/transport.c
index 5a74b60..71f6637 100644
--- a/transport.c
+++ b/transport.c
@@ -1105,7 +1105,8 @@ static int run_pre_push_hook(struct transport *transport,
return ret;
}
-int transport_push(struct transport *transport,
+int transport_push(struct repository *r,
+ struct transport *transport,
struct refspec *rs, int flags,
unsigned int *reject_reasons)
{
@@ -1172,7 +1173,7 @@ int transport_push(struct transport *transport,
oid_array_append(&commits,
&ref->new_oid);
- if (!push_unpushed_submodules(the_repository,
+ if (!push_unpushed_submodules(r,
&commits,
transport->remote,
rs,
@@ -1197,7 +1198,7 @@ int transport_push(struct transport *transport,
oid_array_append(&commits,
&ref->new_oid);
- if (find_unpushed_submodules(the_repository,
+ if (find_unpushed_submodules(r,
&commits,
transport->remote->name,
&needs_pushing)) {
diff --git a/transport.h b/transport.h
index 9baeca2..f2ee7c4 100644
--- a/transport.h
+++ b/transport.h
@@ -223,7 +223,8 @@ void transport_set_verbosity(struct transport *transport, int verbosity,
#define REJECT_FETCH_FIRST 0x08
#define REJECT_NEEDS_FORCE 0x10
-int transport_push(struct transport *connection,
+int transport_push(struct repository *repo,
+ struct transport *connection,
struct refspec *rs, int flags,
unsigned int * reject_reasons);