diff options
author | Jeff King <peff@peff.net> | 2015-05-21 06:45:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-21 20:04:42 +0200 |
commit | a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6 (patch) | |
tree | 2d9d48360152e6090d6c6ebf7591017cb7709083 /builtin/for-each-ref.c | |
parent | remote.c: hoist read_config into remote_get_1 (diff) | |
download | git-a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6.tar.xz git-a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6.zip |
remote.c: introduce branch_get_upstream helper
All of the information needed to find the @{upstream} of a
branch is included in the branch struct, but callers have to
navigate a series of possible-NULL values to get there.
Let's wrap that logic up in an easy-to-read helper.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/for-each-ref.c')
-rw-r--r-- | builtin/for-each-ref.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 83f9cf9163..dc2a201a45 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -664,10 +664,9 @@ static void populate_value(struct refinfo *ref) continue; branch = branch_get(ref->refname + 11); - if (!branch || !branch->merge || !branch->merge[0] || - !branch->merge[0]->dst) + refname = branch_get_upstream(branch); + if (!refname) continue; - refname = branch->merge[0]->dst; } else if (starts_with(name, "color:")) { char color[COLOR_MAXLEN] = ""; |