aboutsummaryrefslogtreecommitdiffstats
path: root/remote.h
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2021-11-17 16:53:22 -0800
committerJunio C Hamano <gitster@pobox.com>2021-11-18 22:31:19 -0800
commitfd3cb0501e175bcac042587cb7bb75e16034a5b7 (patch)
tree50bb4343708d25a77d2c57d575691634f47088a5 /remote.h
parente083ef5d54707a4bb855e8ac6f6ee0576a020349 (diff)
downloadgit-fd3cb0501e175bcac042587cb7bb75e16034a5b7.tar.gz
remote: move static variables into per-repository struct
remote.c does not works with non-the_repository because it stores its state as static variables. To support non-the_repository, we can use a per-repository struct for the remotes subsystem. Prepare for this change by defining a struct remote_state that holds the remotes subsystem state and move the static variables of remote.c into the_repository->remote_state. This introduces no behavioral or API changes. Signed-off-by: Glen Choo <chooglen@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/remote.h b/remote.h
index 5a59198252..d21c035f1b 100644
--- a/remote.h
+++ b/remote.h
@@ -23,6 +23,40 @@ enum {
REMOTE_BRANCHES
};
+struct rewrite {
+ const char *base;
+ size_t baselen;
+ struct counted_string *instead_of;
+ int instead_of_nr;
+ int instead_of_alloc;
+};
+
+struct rewrites {
+ struct rewrite **rewrite;
+ int rewrite_alloc;
+ int rewrite_nr;
+};
+
+struct remote_state {
+ struct remote **remotes;
+ int remotes_alloc;
+ int remotes_nr;
+ struct hashmap remotes_hash;
+
+ struct branch **branches;
+ int branches_alloc;
+ int branches_nr;
+
+ struct branch *current_branch;
+ const char *pushremote_name;
+
+ struct rewrites rewrites;
+ struct rewrites rewrites_push;
+};
+
+void remote_state_clear(struct remote_state *remote_state);
+struct remote_state *remote_state_new(void);
+
struct remote {
struct hashmap_entry ent;