aboutsummaryrefslogtreecommitdiff
path: root/remote.h
diff options
context:
space:
mode:
Diffstat (limited to 'remote.h')
-rw-r--r--remote.h52
1 files changed, 41 insertions, 11 deletions
diff --git a/remote.h b/remote.h
index 19a4905da..d7992c4ef 100644
--- a/remote.h
+++ b/remote.h
@@ -5,6 +5,7 @@
#include "hashmap.h"
enum {
+ REMOTE_UNCONFIGURED = 0,
REMOTE_CONFIG,
REMOTE_REMOTES,
REMOTE_BRANCHES
@@ -14,7 +15,7 @@ struct remote {
struct hashmap_entry ent; /* must be first */
const char *name;
- int origin;
+ int origin, configured_in_repo;
const char *foreign_vcs;
@@ -54,11 +55,12 @@ struct remote {
* for curl remotes only
*/
char *http_proxy;
+ char *http_proxy_authmethod;
};
struct remote *remote_get(const char *name);
struct remote *pushremote_get(const char *name);
-int remote_is_configured(const char *name);
+int remote_is_configured(struct remote *remote, int in_repo);
typedef int each_remote_fn(struct remote *remote, void *priv);
int for_each_remote(each_remote_fn fn, void *priv);
@@ -79,17 +81,21 @@ extern const struct refspec *tag_refspec;
struct ref {
struct ref *next;
- unsigned char old_sha1[20];
- unsigned char new_sha1[20];
- unsigned char old_sha1_expect[20]; /* used by expect-old */
+ struct object_id old_oid;
+ struct object_id new_oid;
+ struct object_id old_oid_expect; /* used by expect-old */
char *symref;
unsigned int
force:1,
forced_update:1,
expect_old_sha1:1,
- expect_old_no_trackback:1,
- deletion:1,
- matched:1;
+ deletion:1;
+
+ enum {
+ REF_NOT_MATCHED = 0, /* initial value */
+ REF_MATCHED,
+ REF_UNADVERTISED_NOT_ALLOWED
+ } match_status;
/*
* Order is important here, as we write to FETCH_HEAD
@@ -150,7 +156,7 @@ extern struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
struct sha1_array *shallow);
int resolve_remote_symref(struct ref *ref, struct ref *list);
-int ref_newer(const unsigned char *new_sha1, const unsigned char *old_sha1);
+int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
/*
* Remove and free all but the first of any entries in the input list
@@ -203,19 +209,42 @@ struct branch {
const char *refname;
const char *remote_name;
- struct remote *remote;
+ const char *pushremote_name;
const char **merge_name;
struct refspec **merge;
int merge_nr;
int merge_alloc;
+
+ const char *push_tracking_ref;
};
struct branch *branch_get(const char *name);
+const char *remote_for_branch(struct branch *branch, int *explicit);
+const char *pushremote_for_branch(struct branch *branch, int *explicit);
int branch_has_merge_config(struct branch *branch);
int branch_merge_matches(struct branch *, int n, const char *);
+/**
+ * Return the fully-qualified refname of the tracking branch for `branch`.
+ * I.e., what "branch@{upstream}" would give you. Returns NULL if no
+ * upstream is defined.
+ *
+ * If `err` is not NULL and no upstream is defined, a more specific error
+ * message is recorded there (if the function does not return NULL, then
+ * `err` is not touched).
+ */
+const char *branch_get_upstream(struct branch *branch, struct strbuf *err);
+
+/**
+ * Return the tracking branch that corresponds to the ref we would push to
+ * given a bare `git push` while `branch` is checked out.
+ *
+ * The return value and `err` conventions match those of `branch_get_upstream`.
+ */
+const char *branch_get_push(struct branch *branch, struct strbuf *err);
+
/* Flags to match_refs. */
enum match_refs_flags {
MATCH_REFS_NONE = 0,
@@ -226,7 +255,8 @@ enum match_refs_flags {
};
/* Reporting of tracking info */
-int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs);
+int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs,
+ const char **upstream_name);
int format_tracking_info(struct branch *branch, struct strbuf *sb);
struct ref *get_local_heads(void);