From: Rudolf Polzer Date: Sat, 16 Jan 2010 18:13:51 GMT Subject: Re: [PATCH v2] Add push --set-upstream Message-ID: <20100116181350.GA28938@rm.endoftheinternet.org> In-Reply-To: On Sat, Jan 16, 2010 at 09:00:30AM +0800, Tay Ray Chuan wrote: > Hi, > > I'm adding people from the "git push --track" thread here, since this > feature is related to what they want. > > (sorry for any line-wrap mangling in the patch.) Looks perfect to me, and if people want it, one could add the same option as an alias to the current --track option to the checkout and branch commands. > > +               /* Chase symbolic refs (mainly for HEAD). */ > > +               localname = i->peer_ref->name; > > +               remotename = i->name; > > +               tmp = resolve_ref(localname, sha, 1, &flag); > > +               if (tmp && flag & REF_ISSYMREF && > > +                       !prefixcmp(tmp, "refs/heads/")) > > +                       localname = tmp; I would never have thought of that case - good catch. > > @@ -974,6 +1016,10 @@ int transport_push(struct transport *transport, > >        verify_remote_names(refspec_nr, refspec); > > > >        if (transport->push) { > > +               /* Maybe FIXME. But no important transport uses this case. */ > > +               if (flags & TRANSPORT_PUSH_SET_UPSTREAM) > > +                       die("This transport does not support using --set-upstream"); > > + That's ONE way to do it - and seriously, I don't know if anyone uses that transport :P However, one possible improvement for this case would be setting ALL pushed refs as tracking if the push succeeded, and none otherwise. Are new transports going to be added that use transport->push, or is that interface deprecated anyway? Best regards, Rudolf Polzer