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
This commit is contained in:
@ -123,14 +123,12 @@ static int branch_merged(int kind, const char *name,
|
||||
|
||||
if (kind == REF_LOCAL_BRANCH) {
|
||||
struct branch *branch = branch_get(name);
|
||||
const char *upstream = branch_get_upstream(branch, NULL);
|
||||
unsigned char sha1[20];
|
||||
|
||||
if (branch &&
|
||||
branch->merge &&
|
||||
branch->merge[0] &&
|
||||
branch->merge[0]->dst &&
|
||||
if (upstream &&
|
||||
(reference_name = reference_name_to_free =
|
||||
resolve_refdup(branch->merge[0]->dst, RESOLVE_REF_READING,
|
||||
resolve_refdup(upstream, RESOLVE_REF_READING,
|
||||
sha1, NULL)) != NULL)
|
||||
reference_rev = lookup_commit_reference(sha1);
|
||||
}
|
||||
@ -427,25 +425,19 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
|
||||
int ours, theirs;
|
||||
char *ref = NULL;
|
||||
struct branch *branch = branch_get(branch_name);
|
||||
const char *upstream;
|
||||
struct strbuf fancy = STRBUF_INIT;
|
||||
int upstream_is_gone = 0;
|
||||
int added_decoration = 1;
|
||||
|
||||
switch (stat_tracking_info(branch, &ours, &theirs)) {
|
||||
case 0:
|
||||
/* no base */
|
||||
return;
|
||||
case -1:
|
||||
/* with "gone" base */
|
||||
if (stat_tracking_info(branch, &ours, &theirs, &upstream) < 0) {
|
||||
if (!upstream)
|
||||
return;
|
||||
upstream_is_gone = 1;
|
||||
break;
|
||||
default:
|
||||
/* with base */
|
||||
break;
|
||||
}
|
||||
|
||||
if (show_upstream_ref) {
|
||||
ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
|
||||
ref = shorten_unambiguous_ref(upstream, 0);
|
||||
if (want_color(branch_use_color))
|
||||
strbuf_addf(&fancy, "%s%s%s",
|
||||
branch_get_color(BRANCH_COLOR_UPSTREAM),
|
||||
|
||||
Reference in New Issue
Block a user