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

Re: [PATCH] remote-hg: store converted URL

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2013, 16:51 UTC
Message-ID
<7vr4lm4cez.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vzk0a4ekj.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> Max Horn <max@quendi.de> writes:
> ...
>> See also the discussion (yeah, this time a real one ;-) leading to this:
>>   https://github.com/felipec/git/issues/2
>> ...

If I understand correctly, the $backend::$opaqueToken is a contract between the remote-helper and the remote-$backend that says "When user wants to interact with the same (foreign) repository, we agreed to let her use 'origin' nickname. The remote-helper looks up this opaque token that corresponds to 'origin' and gives it to the remote-$backend, and whatever is in the opaque token should be sufficient for the remote-$backend to figure out how to proceed from there".

But in this hg::../over/there case, it seems that string is not sufficient for remote-hg to do so and the contract is broken.

When "git clone $backend::$opaqueToken repo" is run in /dir/ecto/ry, and then subsequent "git fetch origin" will be run in (a subdirectory of) /dir/ecto/ry/repo, but anything relative to /dir/ecto/ry will not work once you go inside /dir/ecto/ry/repo. The "create a new repository here" argument could even be an absolute path to a totally different place, so if the remote-$backend wants to use $opaqueToken as anything relative to the $(cwd) when "git clone" was invoked, that original location needs to be available somehow.

Would a new helper protocol message be necessary, so that the backend can rewrite the $opaqueToken at "clone" time and tell the helper what to store as URL instead of the original? I do not think that is much different from remote-$backend updating the value of the remote.origin.URL using "git config".

An alternative approach may be for somebody (either the "git clone" or the remote-$backend) to store a "base directory" when "git clone" was invoked in remote.origin.dirAtCloneTime variable, so that the next time remote-$backend runs, it can read that directory and interpret the $opaqueToken as a relative path to that directory if it wants to. That way, nobody needs to rewrite $opaqueToken.

How do other remote helpers solve this, I have to wonder, though. By not allowing relative paths to a directory?

Previous: Junio C HamanoNext: Max Horn
Message 5 of 8 in “remote-hg: store converted URL”
  1. remote-hg: store converted URLMax Horn, Jan 9, 2013
  2. Junio C HamanoJan 14, 2013
  3. Max HornJan 15, 2013
  4. Junio C HamanoJan 15, 2013
  5. Junio C HamanoJan 15, 2013
  6. Max HornJan 15, 2013
  7. Junio C HamanoJan 15, 2013
  8. Max HornJan 15, 2013

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.