Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2 15/19] pull: teach git pull about --rebase

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:15

Paul Tan [off-list ref] writes:
+/**
+ * Returns remote's upstream branch for the current branch. If remote is NULL,
+ * the current branch's configured default remote is used. Returns NULL if
+ * `remote` does not name a valid remote, HEAD does not point to a branch,
+ * remote is not the branch's configured remote or the branch does not have any
+ * configured upstream branch.
+ */
+static char *get_upstream_branch(const char *remote)
+{
+	struct remote *rm;
+	struct branch *curr_branch;
+
+	rm = remote_get(remote);
+	if (!rm)
+		return NULL;
+
+	curr_branch = branch_get("HEAD");
+	if (!curr_branch)
+		return NULL;
+
+	if (curr_branch->remote != rm)
+		return NULL;
+
+	if (!curr_branch->merge_nr)
+		return NULL;
+
+	return xstrdup(curr_branch->merge[0]->dst);
+}
This part needs to be rebased, as branch->remote no longer exists in
the recent world order.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help