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

Re: [RFC PATCH 06/19] Factor ref updating out of fetch_with_import

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Oct 30, 2009, 16:04 UTC
Message-ID
<alpine.LNX.2.00.0910301118070.14365@iabervon.org>
In-Reply-To
<fabb9a1e0910300557x42d3612pf7e83907e91efdc9@mail.gmail.com>
On Fri, 30 Oct 2009, Sverre Rabbelier wrote:
Show 11 quoted lines
> On Fri, Oct 30, 2009 at 00:10, Daniel Barkalow <barkalow@iabervon.org> wrote:
> > Actually, I think the problem is that builtin-clone will always default to
> > setting up a refspec of "refs/heads/*:refs/remotes/origin/*", but that
> > doesn't actually make any sense if the source repository isn't presented
> > as having refs names like "refs/heads/*". The immediate problem that you
> > don't get HEAD because it's a symref to something outside the pattern is
> > somewhat secondary to the general problem that you don't get anything at
> > all, because everything's outside the pattern.
> 
> Ah, I didn't realize that as long as HEAD is a symref to something in
> refs/heads/* it would be fetched.

Clone only cares about the remote HEAD for the purpose of making refs/remotes/origin/HEAD a symref to something. It doesn't really want a SHA1 for it (except in order to guess that it's a symref to something that the remote has dereferenced in its list); and, since it's a symref, no objects have to be fetched for it -- except for the possibility that it's known to be a symref to something that wasn't fetched, in which case, we know that HEAD -> something, and something's SHA1 is sha1, but we didn't fetch something so we don't have sha1. Of course, I think clone then writes a dangling symref anyway and forgets about sha1.

Show 20 quoted lines
> > I don't really think that presenting the real refs in refs/<vcs>/*, and
> > having the list give symrefs to them from refs/heads/* and refs/tags/*
> > really makes sense; I think it would be better to rework fetch_with_import
> > and the list provided by a foreign vcs helper such that it can present
> > refs with normal names (refs/heads/*, refs/tags/*, etc) if the foreign vcs
> > has standards that correspond to branches and tags. Then "clone" would
> > work normally.
> 
> Perhaps we could introduce an additional phase before import to set
> the default refspec? If we could tell git that we want
> "refs/heads/*:refs/hg/origin/*" before line 468 "if (option_bare) {",
> that would save us a lot of trouble. Does that sound like a good idea?
> It would mean we have to move the transport_get part up a bit, but I
> don't think that will be a problem. A svn helper for example might
> respond the following to the "refspec" command:
> "refs/heads/trunkr:refs/svn/origin/trunk"
> "refs/tags/*:refs/svn/origin/tags/*"
> "refs/heads/*:refs/svn/origin/branches/*"
> 
> How does that sound?

The values you've got for refspecs don't make sense as fetch refspecs; these would cause refs with names the helper won't supply to be stored in the helper's private namespace, which is certainly wrong. (And I think you have the sides backwards)

On the other hand, I think it would make sense to use the same style of refspec between the helper and transport-helper.c such that the helper reports something like:

refs/svn/origin/trunk:refs/heads/trunkr refs/svn/origin/branches/*:refs/heads/* refs/svn/origin/tags/*:refs/tags/*

"list" gives:
000000...000 refs/heads/trunkr

"import refs/heads/trunkr" imports the objects, but the refspecs have to be consulted by transport-helper.c in order to determine what ref to read to get the value of refs/heads/trunkr. Instead of getting the value with read_ref("refs/heads/trunkr", ...) like it does now, it would do read_ref("refs/svn/origin/trunk", ...). And systems like p4 that don't have a useful standard just wouldn't support the "refspec" command and people would have to do site-specific configuration to get anything useful.

	-Daniel
*This .sig left intentionally blank*
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 16 of 43 in “Reroll of the remote-vcs-helper series”
  1. 0/19 Reroll of the remote-vcs-helper seriesSverre Rabbelier, Oct 29, 2009
  2. 01/19 Use a function to determine whether a remote is validSverre Rabbelier, Oct 29, 2009
  3. 02/19 Allow fetch to modify refsSverre Rabbelier, Oct 29, 2009
  4. Daniel BarkalowOct 30, 2009
  5. Sverre RabbelierOct 30, 2009
  6. Daniel BarkalowOct 30, 2009
  7. Sverre RabbelierOct 30, 2009
  8. 03/19 Allow programs to not depend on remotes having urlsSverre Rabbelier, Oct 29, 2009
  9. Daniel BarkalowOct 30, 2009
  10. Sverre RabbelierOct 30, 2009
  11. 04/19 Add a config option for remotes to specify a foreign vcsSverre Rabbelier, Oct 29, 2009
  12. 05/19 Add support for "import" helper commandSverre Rabbelier, Oct 29, 2009
  13. 06/19 Factor ref updating out of fetch_with_importSverre Rabbelier, Oct 29, 2009
  14. Daniel BarkalowOct 30, 2009
  15. Sverre RabbelierOct 30, 2009
  16. Daniel BarkalowOct 30, 2009
  17. Sverre RabbelierNov 2, 2009
  18. Daniel BarkalowNov 2, 2009
  19. Sverre RabbelierNov 2, 2009
  20. Daniel BarkalowNov 2, 2009
  21. 07/19 Allow helpers to report in "list" command that the ref is unchangedSverre Rabbelier, Oct 29, 2009
  22. 08/19 Fix memory leak in helper method for disconnectSverre Rabbelier, Oct 29, 2009
  23. 09/19 Finally make remote helper support usefulSverre Rabbelier, Oct 29, 2009
  24. 10/19 Allow helpers to request marks for fast-importSverre Rabbelier, Oct 29, 2009
  25. Johan HerlandOct 30, 2009
  26. Sverre RabbelierOct 30, 2009
  27. Johan HerlandOct 31, 2009
  28. Sverre RabbelierOct 31, 2009
  29. 11/19 Basic build infrastructure for Python scriptsSverre Rabbelier, Oct 29, 2009
  30. 12/19 1/2: Add Python support library for CVS remote helperSverre Rabbelier, Oct 29, 2009
  31. Johan HerlandOct 30, 2009
  32. Sverre RabbelierOct 30, 2009
  33. 13/19 2/2: Add Python support library for CVS remote helperSverre Rabbelier, Oct 29, 2009
  34. 14/19 git-remote-cvs: Remote helper program for CVS repositoriesSverre Rabbelier, Oct 29, 2009
  35. 15/19 Add simple selftests of git-remote-cvs functionalitySverre Rabbelier, Oct 29, 2009
  36. 16/19 Fix the Makefile-generated path to the git_remote_cvs package in git-remote-cvsSverre Rabbelier, Oct 29, 2009
  37. 17/19 More fixes to the git-remote-cvs installation procedureSverre Rabbelier, Oct 29, 2009
  38. 18/19 Refactor git_remote_cvs to a more generic git_remote_helpersSverre Rabbelier, Oct 29, 2009
  39. Johan HerlandOct 30, 2009
  40. Sverre RabbelierOct 30, 2009
  41. 19/19 .gitignore: add git-remote-cvsSverre Rabbelier, Oct 29, 2009
  42. Shawn O. PearceOct 29, 2009
  43. Sverre RabbelierOct 29, 2009

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.