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


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
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?



Nuxeo Logo

Mincong HuangÂSoftware EngineerÂGithub

Nuxeo Content Services Platform.ÂStay ahead.