Re: [PATCH, fixed] builtin-clone: create remotes/origin/HEAD symref, if guessed
On Mon, Mar 03, 2008 at 05:05:13PM +0000, Kristian Høgsberg wrote:
Show 15 quoted lines
> 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 :)
Show 5 quoted lines
> 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