Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Question about ReceiveCommand status REJECT_NODELETE

Hi,

I'm implementing a server-side pre-receive-hook using JGit. I noticed that when
setting a ReceiveCommand result to `Result.REJECTED_NODELETE` on
server side pre-receive-hook, the client side do not receive the same information:
I would expect the client receives the same status REJECT_NODELETE,
but it actually receives REJECTED_OTHER_REASON.

Expected client result:
  • remoteRefUpdate.getStatus(): Status.REJECT_NODELETE
  • remoteRefUpdate.getMessage(): "deletion prohibited"
Actual client result:
  • remoteRefUpdate.getStatus(): Status.REJECTED_OTHER_REASON
  • remoteRefUpdate.getMessage(): "deletion prohibited"
I did some search in the code,

the server side status is filled by the following lines:

jgit (master u=) $ grep 'case REJECTED_NODELETE:' -n -A 2 \
> ./org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
1850: case REJECTED_NODELETE:
1851- r.append("deletion prohibited"); //$NON-NLS-1$
1852- break;

the client side status is filled by the following lines:

jgit (master u=) $ grep 'Status.REJECTED_OTHER_REASON' -n -B 6 -A 2 \
> org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
404- final RemoteRefUpdate rru = refUpdates.get(refName);
405- if (rru == null)
406- throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedRefReport, uri, refName));
407- if (ok) {
408- rru.setStatus(Status.OK);
409- } else {
410: rru.setStatus(Status.REJECTED_OTHER_REASON);
411- rru.setMessage(message);
412- }

Why the enum status is not aligned between both sides? Is it on purpose,
or perhaps it's the limitation of the transport protocol used?

Best,

--

Nuxeo Logo

Mincong Huang Software Engineer Github

Nuxeo Content Services Platform. Stay ahead.


Back to the top