Paul Tan <pyoka...@gmail.com> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to