From: Tay Ray Chuan Date: Thu, 08 Apr 2010 17:10:09 GMT Subject: Re: [PATCH v2 (resend)] ls-remote: fall-back to default remotes when no remote specified Message-ID: In-Reply-To: <20100408071639.GJ30473@coredump.intra.peff.net> Hi, On Thu, Apr 8, 2010 at 3:16 PM, Jeff King wrote: > On Thu, Apr 08, 2010 at 03:07:07PM +0800, Tay Ray Chuan wrote: > >>       remote = remote_get(dest); >> +     if (!remote) >> +             usage(ls_remote_usage); > > I don't see an update to ls_remote_usage, but shouldn't it now be: > >  git ls-remote [--heads] [--tags]  [-u | --upload-pack ] >    [repository] [...] > > or something now (while we're at it, maybe we can wrap it better as it's > larger than 80 characters). yes. I think  git ls-remote [--heads] [--tags]  [-u | --upload-pack ]     [ [...]] would be more accurate. > But once that is done, shouldn't the (!remote) case say something like > "you don't have a default remote". The user didn't invoke ls-remote > incorrectly (as the usage message shows), but rather there was a > configuration problem. Noted. >> +test_expect_success 'use branch..remote if possible' ' >> + >> +     # Remove "origin" so that we know that ls-remote is not using it. >> +     # >> +     # Ideally, we should test that branch..remote takes precedence >> +     # over "origin", but that is another matter altogether. >> +     # >> +     git remote rm origin && >> +     git config branch.master.remote self && >> +     git ls-remote >actual && >> +     test_cmp expected.all actual >> + >> +' > > Wouldn't your "ideally" just be: > >  git clone . other-remote && >  git push other-remote HEAD:unique-ref && >  git config branch.master.remote other-remote && >  ... > > and check for "unique-ref" in the output? hmm, upon clone, tracking branches are already created, so we can just treat them as the "unique refs", without having to create a unique ref. -- Cheers, Ray Chuan