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

From: "Shawn O. Pearce" <[email-masked]>
Date: Sat, 7 Mar 2009 13:10:08 -0800

Robin Rosenberg <[email-masked]> wrote:
> lördag 07 mars 2009 17:05:02 skrev Daniel Cheng <[email-masked]>:
> > 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.