git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 (resend)] ls-remote: fall-back to default remotes when no remote specified

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Apr 8, 2010, 17:10 UTC
Message-ID
<t2mbe6fef0d1004081010sb6dfd0e1l2e73a36ef1af3870@mail.gmail.com>
In-Reply-To
<20100408071639.GJ30473@coredump.intra.peff.net>
Hi,
On Thu, Apr 8, 2010 at 3:16 PM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> 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 <exec> | --upload-pack <exec>]
>    [repository] [<refs>...]
>
> 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 <exec> | --upload-pack <exec>]
                [<repository> [<refs>...]]
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.
Show 22 quoted lines
>> +test_expect_success 'use branch.<name>.remote if possible' '
>> +
>> +     # Remove "origin" so that we know that ls-remote is not using it.
>> +     #
>> +     # Ideally, we should test that branch.<name>.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
Previous: Jeff KingNext: Tay Ray Chuan
Message 14 of 18 in “ls-remote: default to 'origin' when no remote specified”
  1. ls-remote: default to 'origin' when no remote specifiedTay Ray Chuan, Apr 8, 2010
  2. Jeff KingApr 8, 2010
  3. Junio C HamanoApr 8, 2010
  4. Jeff KingApr 8, 2010
  5. Tay Ray ChuanApr 8, 2010
  6. Jeff KingApr 8, 2010
  7. Junio C HamanoApr 8, 2010
  8. Jeff KingApr 8, 2010
  9. Junio C HamanoApr 8, 2010
  10. Tay Ray ChuanApr 8, 2010
  11. ls-remote: fall-back to default remotes when no remote specifiedTay Ray Chuan, Apr 8, 2010
  12. ls-remote: fall-back to default remotes when no remote specifiedTay Ray Chuan, Apr 8, 2010
  13. Jeff KingApr 8, 2010
  14. Tay Ray ChuanApr 8, 2010
  15. ls-remote: fall-back to default remotes when no remote specifiedTay Ray Chuan, Apr 8, 2010
  16. Jeff KingApr 8, 2010
  17. Peter KjellerstedtApr 9, 2010
  18. Tay Ray ChuanApr 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.