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

Re: [JGit] Push to new Amazon S3 does not work? ("funny refname")

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 7, 2009, 21:10 UTC
Message-ID
<20090307211008.GP16213@spearce.org>
In-Reply-To
<200903071850.38045.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 15 quoted lines
> lördag 07 mars 2009 17:05:02 skrev Daniel Cheng <j16sdiz+freenet@gmail.com>:
> > Pushing to new Amazon S3 repository does not work.
> > It say "funny refname" without pushing anything:
> > 
> > <<<<<<<<<
> > $ jgit push s3 master
> > To amazon-s3://0NQ4APQ8R7S6HQ65TWR2@egitsdiz/1.git
> >  ! [remote rejected] master -> master (funny refname)
> > $ s3cmd la
> >          DIR   s3://egitsdiz/1.git/
> > $
> > >>>>>>>>>
> 
> This is not specific to s3. It seems jgit wants a fully qualified ref for the remote
> side, so refs/heads/master will work for the other protocols, and I guess s3 too.
Correct.
The "jgit push" command line client lacks the DWIMery of "git push".

Specifically, from a pure API usage perspective, "jgit push" is responsible for expanding the user input of "master" into the "refs/heads/master:refs/heads/master" refspec that the lower level PushProcess class wants.

Here it failed to do that, and the lower-level transport (rightly) rejected the invalid ref name.

  Side note:
  That API definition that says the client should do the DWIMery
  of ref expansion also makes it nearly impossible to implement
  "push matching" or "randomsha1:master" refspec, as the client
  doesn't have the network connection open and doesn't have the
  advertised ref information early enough.

The reason we punted on this and didn't do this particular expansion DWIMery in "jgit push" is we lack a good way to resolve "master" into "refs/heads/master", or "v1.0" into "refs/tags/v1.0". Repository does not expose the ref lookup algorithm, only resolve(), which converts "master" into a SHA-1 ObjectId.

If someone exposed this portion of the resolve logic in the Repository class, I think it would be a fairly simple change in Push to support this DIWMery.

But until then, you need to say:
  jgit push s3 refs/heads/master:refs/heads/master
or maybe this DWIMery might work:
  jgit push s3 refs/heads/master

Its been a while since I passed args. I usually have remote.$name.push in place for things that I push to.

-- 
Shawn.
Previous: Robin RosenbergNext: Robin Rosenberg
Message 3 of 8 in “[JGit] Push to new Amazon S3 does not work? ("funny refname")”
  1. Daniel ChengMar 7, 2009
  2. Robin RosenbergMar 7, 2009
  3. Shawn O. PearceMar 7, 2009
  4. Evaluate short refnames into full names during pushRobin Rosenberg, Mar 7, 2009
  5. Shawn O. PearceMar 7, 2009
  6. Prevent an exception if the user tries to push a non-existing ref.Robin Rosenberg, Mar 8, 2009
  7. Shawn O. PearceMar 9, 2009
  8. Robin RosenbergMar 9, 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.