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

Re: insteadOf and git-request-pull output

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 17, 2018, 07:46 UTC
Message-ID
<xmqq7ehci1td.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181116115639.GO890086@genre.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 14 quoted lines
>> $ git request-pull HEAD^ git://foo.example.com/example | grep example
>>   ssh://bar.example.com/example
>> 
>> I think that if we use the "principle of least surprise," insteadOf
>> rules shouldn't be applied for git-request-pull URLs.
>
> I'd like to point out a different use that may change your view.  I have
> an insteadOf alias, gh:, that points to GitHub.  Performing the rewrite
> is definitely the right thing to do, since other users may not have my
> alias available.
>
> I agree that in your case, a rewrite seems less appropriate, but I think
> we should only skip the rewrite if the value already matches a valid
> URL.

It would be tricky to define what a valid URL is, though. Do we need some way to say "this is a private URL that should not be given preference when composing a request-pull message"? E.g.

    [url "git://git.dev/"]
            insteadOf = https://git.dev/
    [url "https://github.com/"]
            insteadOf = gh:
	    private

The former does not mark https://git.dev/ a private one, so a "request-pull https://git.dev/$thing" would show the original "https://git.dev/$thing" without rewriting. The latter marks gh: a private one so "request-pull gh:$thing" would be rewritten before exposed to the public as "https://github.com/$thing"

Or something like that?
Previous: brian m. carlsonNext: Jeff King
Message 6 of 9 in “insteadOf and git-request-pull output”
  1. Konstantin RyabitsevNov 15, 2018
  2. Ævar Arnfjörð BjarmasonNov 15, 2018
  3. Konstantin RyabitsevNov 15, 2018
  4. Junio C HamanoNov 16, 2018
  5. brian m. carlsonNov 16, 2018
  6. Junio C HamanoNov 17, 2018
  7. Jeff KingNov 17, 2018
  8. Junio C HamanoNov 17, 2018
  9. Jeff KingNov 22, 2018

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.