Community
Participate
Working Groups
The error returned by JGit when trying to push a ref that conflicts with an existing ref does not provide the level of detail CGit provides. For example: 1. Create and push branch refs/heads/prefix/suffix 2. Create and try to push branch refs/heads/prefix CGit will return the following error: [chris@antergos test-ref]$ git push origin prefix Total 0 (delta 0), reused 0 (delta 0) remote: error: cannot lock ref 'refs/heads/prefix': 'refs/heads/prefix/suffix' exists; cannot create 'refs/heads/prefix' To /home/chris/tmp/test-ref.git/ ! [remote rejected] prefix -> prefix (failed to update ref) error: failed to push some refs to '/home/chris/tmp/test-ref.git/' But services using JGit return the following: GitBlit: [chris@antergos gitblit]$ git push origin prefix Total 0 (delta 0), reused 0 (delta 0) remote: Updating references: 100% (1/1) To https://chris@gitblit-server/r/testing/test-prefix.git ! [remote rejected] prefix -> prefix (failed to lock) error: failed to push some refs to 'https://chris@gitblit-server/r/testing/test-prefix.git' Gerrit: [chris@antergos gerrit]$ git push origin prefix Total 0 (delta 0), reused 0 (delta 0) remote: Processing changes: refs: 1, done To http://admin@localhost:8080/gerrit ! [remote rejected] prefix -> prefix (failed to lock) error: failed to push some refs to 'http://admin@localhost:8080/gerrit' I'm not sure if this is actually the responsibility of GitBlit/Gerrit to do. JGit however seems to be throwing back a LOCK_FAILURE result, which can be misleading given that that kind of error is often transient, but this particular case is not.