summaryrefslogtreecommitdiff
path: root/builtin/for-each-ref.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-05-21 04:45:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-05-21 18:04:42 (GMT)
commita9f9f8cc1f59104257eb1a11a2d048f54dd92ee6 (patch)
tree2d9d48360152e6090d6c6ebf7591017cb7709083 /builtin/for-each-ref.c
parent8770e6fbb28dffdf9e00d05365120e438d3d236f (diff)
downloadgit-a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6.zip
git-a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6.tar.gz
git-a9f9f8cc1f59104257eb1a11a2d048f54dd92ee6.tar.bz2
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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 83f9cf9..dc2a201 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] = "";