git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 07/22] transport.c: remove implicit dependency on the_index

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 10, 2018, 05:48 UTC
Message-ID
<20181110054910.10568-8-pclouds@gmail.com>
In-Reply-To
<20181110054910.10568-1-pclouds@gmail.com>

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>
---
 builtin/push.c | 3 ++-
 transport.c    | 7 ++++---
 transport.h    | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index d09a42062c..efb3e38a8d 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 5a74b609ff..71f663743f 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 9baeca2d7a..f2ee7c4f49 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);
 
-- 
2.19.1.1231.g84aef82467
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 7 of 24 in “Kill the_index part 5”
  1. 00/22 Kill the_index part 5Nguyễn Thái Ngọc Duy, Nov 10, 2018
  2. 01/22 wt-status.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  3. 03/22 list-objects-filter.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  4. 04/22 list-objects.c: reduce the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  5. 05/22 notes-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  6. 06/22 notes-merge.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  7. 07/22 transport.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  8. 08/22 sequencer.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  9. 09/22 sequencer.c: remove implicit dependency on the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  10. 11/22 bisect.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  11. 12/22 branch.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  12. 14/22 cache-tree.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  13. 15/22 delta-islands.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  14. 17/22 line-log.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  15. 18/22 notes-cache.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  16. 19/22 pack-check.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  17. 20/22 pack-*.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  18. 21/22 rerere.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  19. 22/22 rebase-interactive.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  20. 16/22 diff-lib.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  21. 13/22 bundle.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  22. 10/22 blame.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  23. 02/22 wt-status.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  24. Junio C HamanoNov 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.