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

Re: [PATCH] (preview) Renaming push.

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 3, 2005, 23:48 UTC
Message-ID
<Pine.LNX.4.58.0508031641270.3258@g5.osdl.org>
In-Reply-To
<7vek9a8uy9.fsf_-_@assigned-by-dhcp.cox.net>
On Wed, 3 Aug 2005, Junio C Hamano wrote:
>
> This allows git-send-pack to push local refs to a destination
> repository under different names.
Looks good, except I was almost hoping for one modification:
Show 15 quoted lines
> Here is the name mapping rules for refs.
> 
> * If there is no ref mapping on the command line:
> 
>  - if '--all' is specified, it is equivalent to specifying
>    <local> ":" <local> for all the existing local refs on the
>    command line
>  - otherwise, it is equivalent to specifying <ref> ":" <ref> for
>    all the refs that exist on both sides.
> 
> * <name> is just a shorthand for <name> ":" <name>
> 
> * <src> ":" <dst>
> 
>   push ref that matches <src> to ref that matches <dst>.

In this format, "src" makes sense as a generic sha1_name, and _not_ necessarily limited to a ref-name.

IOW, there's really no reason to not allow
	git-send-pack .. dest .. <sha1>:dst-ref

where "<sha1>" may be something else than a ref (but a ref obviously ends up being one such thing).

For example, let's say that I've got stuff at the HEAD of my tree that I'm not quite ready to push out yet, but I _do_ want to push out the parent of the current head. I'd love to be able to just do

	git-send-pack parent $(git-rev-parse HEAD^):master

and there's no real reason why that syntax shouldn't just work: it's entirely logical to say "I want to push out the parent of my HEAD as 'master' on the other end", and that's _exactly_ what the above says.

So:
>   - It is an error if <src> does not match exactly one of local
>     refs.

I think "src" should just be seen as any random SHA1 name, and we should use "get_sha()" to convert it to a SHA1.

In contrast, "dst" is obviously a real ref name, and as such:
>   - It is an error if <dst> matches more than one remote refs.
makes sense.
That makes your next rule a bit iffy, though:
Show 8 quoted lines
>   - If <dst> does not match any remote refs, either
> 
>     - it has to start with "refs/"; <dst> is used as the
>       destination literally in this case.
> 
>     - <src> == <dst> and the ref that matched the <src> must not
>       exist in the set of remote refs; the ref matched <src>
>       locally is used as the name of the destination.
since "src" from a local standpoint isn't really a ref-name at all.

But hey, your current patch looks fine already. It doesn't _quite_ do what I had in mind, but it gets very very close.

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 18 of 37 in “Users of git-check-files?”
  1. Johannes SchindelinAug 2, 2005
  2. Linus TorvaldsAug 3, 2005
  3. Junio C HamanoAug 3, 2005
  4. Johannes SchindelinAug 3, 2005
  5. Linus TorvaldsAug 3, 2005
  6. Johannes SchindelinAug 3, 2005
  7. Linus TorvaldsAug 3, 2005
  8. Junio C HamanoAug 3, 2005
  9. Linus TorvaldsAug 3, 2005
  10. Junio C HamanoAug 3, 2005
  11. Linus TorvaldsAug 3, 2005
  12. Johannes SchindelinAug 3, 2005
  13. Josef WeidendorferAug 3, 2005
  14. Junio C HamanoAug 3, 2005
  15. Josef WeidendorferAug 3, 2005
  16. Linus TorvaldsAug 3, 2005
  17. (preview) Renaming push.Junio C Hamano, Aug 3, 2005
  18. Linus TorvaldsAug 3, 2005
  19. Junio C HamanoAug 4, 2005
  20. Linus TorvaldsAug 4, 2005
  21. Junio C HamanoAug 4, 2005
  22. Junio C HamanoAug 4, 2005
  23. Linus TorvaldsAug 4, 2005
  24. Junio C HamanoAug 4, 2005
  25. Teach rev-list since..til notation.Junio C Hamano, Aug 4, 2005
  26. Linus TorvaldsAug 3, 2005
  27. Junio C HamanoAug 3, 2005
  28. Linus TorvaldsAug 3, 2005
  29. Junio C HamanoAug 3, 2005
  30. Josef WeidendorferAug 3, 2005
  31. Linus TorvaldsAug 3, 2005
  32. Linus TorvaldsAug 3, 2005
  33. Junio C HamanoAug 3, 2005
  34. Josef WeidendorferAug 3, 2005
  35. Johannes SchindelinAug 3, 2005
  36. Junio C HamanoAug 4, 2005
  37. Johannes SchindelinAug 4, 2005

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.