-
Your analysis is correct.
OneDev's git
pre-receive/post-receivehook forwards stdin to the server with curl-d @-, which is treated asapplication/x-www-form-urlencoded. In that encoding,+is decoded as a space.So a ref update like:
<old-oid> <new-oid> refs/tags/1.0.10+16arrives as:
<old-oid> <new-oid> refs/tags/1.0.10 16GitPreReceiveCallbackthen splits on spaces and passesrefs/tags/1.0.10toObjectId.fromString(...), which produces exactly the exception you saw:InvalidObjectIdException: Invalid id: refs/tags/1.0.10+is a valid Git ref character, but OneDev currently cannot parse ref updates whose names contain+. The same encoding applies to branch names containing+; typical branch pushes succeed because they do not use that character.Until this is fixed, use a tag name without
+(for example1.0.10-16or1.0.10_16). -
@servicedesk create a bug report for this and add all users here to watch list
-
-
@robin Created bug issue #3055 for this and added @sen23, @robin, and @servicedesk to its watch list.
Closing this Question.
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Environment
1.0.10+16Description
Pushing a Git tag whose name contains a
+character fails during the server-side pre-receive hook.For example:
The client receives:
The tag remains local and is not created on the remote repository.
Normal branch pushes to the same repository/server work correctly.
Server-side exception
At the same time, OneDev logs the following exception:
The interesting part is:
The original tag being pushed is:
but the exception only contains:
Steps to reproduce
+:Actual result
The push is rejected:
OneDev logs:
from:
Expected result
+is a valid character in a Git ref/tag name.The following tag should therefore be accepted normally:
and the tag should be created on the remote repository.
Suspected cause
This appears to be related to URL/form decoding in the pre-receive hook callback.
The original ref update contains:
If the hook sends the ref-update data as
application/x-www-form-urlencodedwithout encoding the literal+, a servlet/form decoder may interpret+as a space:becoming:
If OneDev then parses the ref-update record by whitespace, the fields become shifted.
That would explain why:
is eventually passed to:
and results in:
This is only a suspected root cause, but the server-side exception appears consistent with the
+character being decoded as whitespace beforeGitPreReceiveCallbackparses the ref update.Related observations
GitPreReceiveCallback.+16, while the exception showsrefs/tags/1.0.10, suggesting the+affects parsing before the object ID conversion.Related issues checked
I checked several existing tag/push-related issues, but they appear to have different root causes:
curl (22) / pre-receive hook declinedsymptom, but related to repository/filesystem ownershipsafe.directoryissueI could not find an existing issue specifically describing a tag/ref containing
+causingGitPreReceiveCallbackto parse the ref incorrectly.