From: Pierre Habouzit Date: Mon, 03 Mar 2008 17:09:43 GMT Subject: Re: [PATCH, fixed] builtin-clone: create remotes/origin/HEAD symref, if guessed Message-ID: <20080303170942.GB23210@artemis.madism.org> In-Reply-To: <1204563913.4084.3.camel@gaara.boston.redhat.com> On Mon, Mar 03, 2008 at 05:05:13PM +0000, Kristian Høgsberg wrote: > On Sun, 2008-03-02 at 06:25 +0000, Johannes Schindelin wrote: > > + strbuf_init(&head_ref, 0); > > + strbuf_addstr(&head_ref, branch_top); > > + strbuf_addstr(&head_ref, "/HEAD"); > > + delete_ref(head_ref.buf, head_points_at->old_sha1); > > + strbuf_init(&real_ref, 0); > > + strbuf_addstr(&real_ref, branch_top); > > + strbuf_addch(&real_ref, '/'); > > + strbuf_addstr(&real_ref, head); > > What about just using > > strbuf_addf(&real_ref, "%s/%s", branch_top, head); > > Are you worried about performance? :-p If he was he would have used strbuf_init(&real_ref, 1024) or sth like that I assume :) > Oh and I'm wondering if > > strbuf_initf(&real_ref, "%s/%s", branch_top, head); > > would be a worthwhile addition to the strbuf API... I don't think so, unless there are 1289 places in git that would benefit from the shortcut it gives, but I really doubt it. -- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org