stable

Clone or download

Read-only

feat: Close artifacts referenced in commit message

part of story #26802 have smart commit with Tuleap Git How to test: - forge your database to allow artifact closure in a git repository - commit on the default branch (for example master or main) of the git repository. Your commit message should have a "closing reference" to an artifact in the same project, like the following: closes art #123 - push the default branch - You should see a debug line in codendi_syslog like the following: [debug] Closed artifact #123 - The artifacts you referenced are closed with a follow-up comment (from workflow manager) referencing the @user_login, the closing keyword (same as GitLab) and a reference to the Git commit. The @login should show your user on hover and the reference should redirect to the commit you pushed. If you write a reference to an artifact that does not exist or that you don't have permission to see, it is silently ignored. If you write a reference to an artifact from another project, it is silently ignored. If the closing comment does not match the allowed keywords, it is silently ignored. If there is no Done semantic, it will fall back on Status closed value. If there is no Status closed value (all values are open or semantic is not set), it will add a follow-up comment with a message (similar to Gitlab). Notes: I am adding lines to psalm baseline because I don't know how risky it is to add types to UserManager::getUserById(). It has extremely high usage in the codebase. Change-Id: I6ad4230979bc83e69ff2988bc4c4895bfad0c37b

Modified Files

Name
A plugins/git/include/CommitMetadata/GitCommitReferenceString.php +47 −0 Go to diff View file
M plugins/git/include/Hook/Asynchronous/CommitAnalysisOrder.php +18 −5 Go to diff View file
M plugins/git/include/Hook/Asynchronous/CommitAnalysisProcessor.php +8 −1 Go to diff View file
M plugins/git/include/Hook/GitPushReceptionDispatcher.php +6 −1 Go to diff View file
A plugins/git/tests/unit/CommitMetadata/GitCommitReferenceStringTest.php +55 −0 Go to diff View file
M plugins/git/tests/unit/Hook/Asynchronous/CommitAnalysisOrderTest.php +6 −4 Go to diff View file
M plugins/git/tests/unit/Hook/Asynchronous/CommitAnalysisProcessorTest.php +12 −2 Go to diff View file
M plugins/git/tests/unit/Hook/GitPushReceptionDispatcherTest.php +1 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Closure/ArtifactClosingReferencesHandler.php +44 −7 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/Closure/BadSemanticComment.php +48 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/RetrieveViewableArtifact.php +1 −4 Go to diff View file
M plugins/tracker/include/trackerPlugin.php +103 −1 Go to diff View file
M plugins/tracker/tests/unit/Artifact/Closure/ArtifactClosingReferencesHandlerTest.php +112 −13 Go to diff View file
A plugins/tracker/tests/unit/Artifact/Closure/BadSemanticCommentTest.php +42 −0 Go to diff View file
M plugins/tracker/tests/unit/Stub/RetrieveStatusFieldStub.php +26 −4 Go to diff View file
A plugins/tracker/tests/unit/Stub/RetrieveViewableArtifactStub.php +59 −0 Go to diff View file
M src/common/Event/Events/PotentialReferencesReceived.php +9 −2 Go to diff View file
A src/common/User/RetrieveUserById.php +32 −0 Go to diff View file
M src/common/User/UserManager.class.php +2 −1 Go to diff View file
A tests/lib/Stubs/RetrieveUserByIdStub.php +45 −0 Go to diff View file
M tests/psalm/tuleap-baseline.xml +10 −0 Go to diff View file