Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-05-21 07:45:28 +0300
committerJunio C Hamano <gitster@pobox.com>2015-05-21 21:04:42 +0300
commita9f9f8cc1f59104257eb1a11a2d048f54dd92ee6 (patch)
tree2d9d48360152e6090d6c6ebf7591017cb7709083 /builtin/for-each-ref.c
parent8770e6fbb28dffdf9e00d05365120e438d3d236f (diff)
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 83f9cf91633..dc2a201a451 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] = "";