I was hoping that a JGit developer would chime in - there are a few
that patrol this group - but I know several were involved with
EclipseCon so they may be busy or traveling.
I do not know why the Git client does not receive your message. I
have confirmed your experience with command-line git on my system.
When you are setting that message, you are setting it directly into a
JGit ReceiveCommand and the SmartHTTP GitServlet _should_ relay that
to the client. I know I've read that not all clients support return
messages, but I think that may be old information and that all current
clients do support return messages.
If we don't get a response here by Monday I'll bring it up on the JGit
developer list. Maybe I need to make an adjustment to Gitblit to
ensure the message is returned to the client.
-J
The following JavaDoc snippet is from the ReceivePack.sendError(String what)
* {@link PreReceiveHook}s should always try to use
* {@link ReceiveCommand#setResult(Result, String)} with a result status of
* {@link Result#REJECTED_OTHER_REASON} to indicate any reasons for
* rejecting an update. Messages attached to a command are much more likely
* to be returned to the client.
I've gotten a reply from the JGit team. This may be a bug in the git
client you are using. I'm running older clients on my machines than
the version Dave references. I have not verified/re-tried this with a
newer client. What version are you using?
-J
On Fri, Mar 30, 2012 at 09:37, <james...@gitblit.com> wrote:
Hi JGit Team,
PreReceive rejection.
receiveCommand.setResult(Result.REJECTED_OTHER_REASON, "this git server
does not like you")
I expected that the reason would be displayed client-side. This does
not appear to be the case. The JavaDoc for sendError suggests that
setResult(result, reason) is the appropriate technique for reporting a
rejection error message to the client.
Yes, that's correct.
Is Gitblit doing something
incorrect here? Should the Gitblit receive hook call sendError manually
if a prereceive command result is one of the REJECTED enum values?
You may choose to call sendError independently, but those error
messages are displayed before the per-branch error messages.
Until recently there was a bug where the C git client would fail to
display per-ref status messages under some circumstances. What git
client version are you using? The bug I'm thinking of was fixed in
5238cbf65638d7a097bdb5ca8226f5acbe31f143, included in v1.7.9.2.
Yeah, I can see the utility of something like that..
If you are already hacking away at that why don't you whip up a proposal.
-J
Thanks for the contributions!
-J