path: root/remote.h
diff options
authorJunio C Hamano <>2015-06-05 19:17:36 (GMT)
committerJunio C Hamano <>2015-06-05 19:17:36 (GMT)
commitc4a8354bc14e20d5ca6dc353e17e5b27fefefdab (patch)
tree329e196f78a1563e7e8674af8b4f9324db973ce7 /remote.h
parentf86f31ab33c3406adebbb9f9f61be550dcc5a472 (diff)
parent29bc88505f22068d7ee6694240e6b13fddb5d059 (diff)
Merge branch 'jk/at-push-sha1'
Introduce <branch>@{push} short-hand to denote the remote-tracking branch that tracks the branch at the remote the <branch> would be pushed to. * jk/at-push-sha1: for-each-ref: accept "%(push)" format for-each-ref: use skip_prefix instead of starts_with sha1_name: implement @{push} shorthand sha1_name: refactor interpret_upstream_mark sha1_name: refactor upstream_mark remote.c: add branch_get_push remote.c: return upstream name from stat_tracking_info remote.c: untangle error logic in branch_get_upstream remote.c: report specific errors from branch_get_upstream remote.c: introduce branch_get_upstream helper remote.c: hoist read_config into remote_get_1 remote.c: provide per-branch pushremote name remote.c: hoist branch.*.remote lookup out of remote_get_1 remote.c: drop "remote" pointer from "struct branch" remote.c: refactor setup of branch->merge list remote.c: drop default_remote_name variable
Diffstat (limited to 'remote.h')
1 files changed, 26 insertions, 2 deletions
diff --git a/remote.h b/remote.h
index 02d66ce..312b7ca 100644
--- a/remote.h
+++ b/remote.h
@@ -203,19 +203,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 {
@@ -226,7 +249,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);