From: Mike Hommey Date: Mon, 18 Feb 2008 19:00:43 GMT Subject: Re: [PATCH] branch: optionally setup branch.*.merge from upstream local branches Message-ID: <20080218190043.GA24240@glandium.org> In-Reply-To: On Mon, Feb 18, 2008 at 01:29:55PM +0000, Johannes Schindelin wrote: > Hi, > > sorry, I overlooked that earlier: > > On Mon, 18 Feb 2008, Jay Soffian wrote: > > > diff --git a/branch.c b/branch.c > > index 1fc8788..24e98dd 100644 > > --- a/branch.c > > +++ b/branch.c > > @@ -130,7 +130,15 @@ void create_branch(const char *head, > > automatically merges from there. So far, this is only done for > > remotes registered via .git/config. */ > > if (real_ref && track) > > - setup_tracking(name, real_ref); > > + if (setup_tracking(name, real_ref) == 1 && track == BRANCH_TRACK_ALWAYS) { > > This line is too long. > > > + char key[1024]; > > + sprintf(key, "branch.%s.remote", name); > > To stay safe, you should use snprintf() and test the return value. Or use strbufs. Mike