Protected branches can be deleted

Issue #668 resolved
Former user created an issue


for test purpose we create user with WRITE permission on repository and set 1.12 branch as deny for change. When we trying to push changes it works normal:

$ git push origin 1.12
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 275 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: error: [SCM] no write permissions for the branch
To http://readuser@svndev/git/testbwp.git
 ! [remote rejected] 1.12 -> 1.12 (unspecified reason)
error: failed to push some refs to 'http://readuser@svndev/git/testbwp.git'
2015-01-15 14:36:05.108 [http-bio-8080-exec-91472] WARN  sonia.scm.branchwp.BranchWPContext - access denied for user readuser at branch 1.12
2015-01-15 14:36:05.108 [http-bio-8080-exec-91472] WARN  sonia.scm.branchwp.BranchWPPreReceiveRepositoryHook - access denied for branch [1.12]
2015-01-15 14:36:05.118 [http-bio-8080-exec-91472] ERROR sonia.scm.web.GitReceiveHook - could not handle receive commands
sonia.scm.branchwp.BranchWPException: no write permissions for the branch
    at sonia.scm.branchwp.BranchWPPreReceiveRepositoryHook.handleBranchWP

but if you try to delete this branch restrictions is not working

$ git push origin --delete 1.12
remote: Updating references: 100% (1/1)
To http://readuser@svndev/git/testbwp.git
 - [deleted]         1.12

$ git branch -r
2015-01-15 14:38:10.077 [EventBus-1555] INFO - user readuser executes sonia.scm.repository.LastModifiedUpdateListener$LastModifiedPrivilegedAction as admin
2015-01-15 14:38:10.077 [EventBus-1555] INFO  sonia.scm.repository.LastModifiedUpdateListener - update last modified date of repository CKP1QhhQn4
2015-01-15 14:38:10.077 [EventBus-1555] INFO  sonia.scm.repository.DefaultRepositoryManager - modify repository testbwp.git of type git
2015-01-15 14:38:10.094 [Hook-753] WARN  sonia.scm.pushlog.PushlogHook - received hook without changesets
2015-01-15 14:38:10.094 [Hook-752] WARN  sonia.scm.jenkins.JenkinsGlobalHookHandler - global configuration is not valid
2015-01-15 14:38:10.095 [Hook-752] ERROR sonia.scm.notify.NotifyRepositoryHook - received hook without changesets

Comments (7)

  1. Sebastian Sdorra repo owner
    • changed status to open

    Ok, i can reproduce the issue. The problem is that the PostReceiveHook of scm-manager does only receive new changesets/commits, but deleting a branch does not send commits. I will think about a solution for the problem.

  2. Sebastian Sdorra repo owner

    The first step is done, i've extended the api to get informed about deleted branches:

    The next steps are:

    • wait for the release of scm-manager 1.45
    • update the branchwp plugin to use the new api
    • release a new version of the branchwp plugin
  3. Sebastian Sdorra repo owner

    Version 1.45 of SCM-Manager and version 1.3 of the scm-branchwp-plugin are released. The issue should now be fixed. Please reopen the issue, if you are able to reproduce the issue, with those new versions.

  4. Log in to comment