From: Jeff King Date: Wed, 24 Feb 2010 17:08:53 +0000 (-0500) Subject: push: fix segfault for odd config X-Git-Tag: v1.7.0.3~25^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=db03b55781f23a9276234faf9a21922ff8c5678d;p=git.git push: fix segfault for odd config If you have a branch.$X.merge config option, but no branch.$X.remote, and your configuration tries to push tracking branches, git will segfault. The problem is that even though branch->merge_nr is 1, you don't actually have an upstream since there is no remote. Other callsites generally check explicitly that branch->merge is not NULL, so let's do that here, too. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/builtin-push.c b/builtin-push.c index 45fe843b2..041e5f460 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -54,7 +54,7 @@ static void setup_push_tracking(void) struct branch *branch = branch_get(NULL); if (!branch) die("You are not currently on a branch."); - if (!branch->merge_nr) + if (!branch->merge_nr || !branch->merge) die("The current branch %s is not tracking anything.", branch->name); if (branch->merge_nr != 1)