@@ -112,8 +112,7 @@ public Branch createBranch(Integer projectId, String branchName, String ref) thr
112112
113113
114114 /**
115- * Delete a single project repository branch. This is an idempotent function,
116- * protecting an already protected repository branch will not produce an error.
115+ * Delete a single project repository branch.
117116 *
118117 * DELETE /projects/:id/repository/branches/:branch
119118 *
@@ -138,7 +137,7 @@ public void deleteBranch(Integer projectId, String branchName) throws GitLabApiE
138137 * @throws GitLabApiException if any exception occurs
139138 */
140139 public Branch protectBranch (Integer projectId , String branchName ) throws GitLabApiException {
141- Response response = put (Response .Status .OK , null , "projects" , projectId , "repository" , "branches" , branchName , "protect" );
140+ Response response = put (Response .Status .OK , null , "projects" , projectId , "repository" , "branches" , urlEncode ( branchName ) , "protect" );
142141 return (response .readEntity (Branch .class ));
143142 }
144143
@@ -154,7 +153,7 @@ public Branch protectBranch(Integer projectId, String branchName) throws GitLabA
154153 * @throws GitLabApiException if any exception occurs
155154 */
156155 public Branch unprotectBranch (Integer projectId , String branchName ) throws GitLabApiException {
157- Response response = put (Response .Status .OK , null , "projects" , projectId , "repository" , "branches" , branchName , "unprotect" );
156+ Response response = put (Response .Status .OK , null , "projects" , projectId , "repository" , "branches" , urlEncode ( branchName ) , "unprotect" );
158157 return (response .readEntity (Branch .class ));
159158 }
160159
0 commit comments