mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fix branch name.
This commit is contained in:
@@ -87,6 +87,7 @@ class CommitLogHook(owner: String, repository: String, userName: String, baseURL
|
|||||||
commands.asScala.foreach { command =>
|
commands.asScala.foreach { command =>
|
||||||
val commits = JGitUtil.getCommitLog(git, command.getOldId.name, command.getNewId.name)
|
val commits = JGitUtil.getCommitLog(git, command.getOldId.name, command.getNewId.name)
|
||||||
val refName = command.getRefName.split("/")
|
val refName = command.getRefName.split("/")
|
||||||
|
val branchName = refName.drop(2).mkString("/")
|
||||||
|
|
||||||
// Extract new commit and apply issue comment
|
// Extract new commit and apply issue comment
|
||||||
val newCommits = if(commits.size > 1000){
|
val newCommits = if(commits.size > 1000){
|
||||||
@@ -113,15 +114,16 @@ class CommitLogHook(owner: String, repository: String, userName: String, baseURL
|
|||||||
if(refName(1) == "heads"){
|
if(refName(1) == "heads"){
|
||||||
command.getType match {
|
command.getType match {
|
||||||
case ReceiveCommand.Type.CREATE => {
|
case ReceiveCommand.Type.CREATE => {
|
||||||
recordCreateBranchActivity(owner, repository, userName, refName(2))
|
println(command.getRefName)
|
||||||
recordPushActivity(owner, repository, userName, refName(2), newCommits)
|
recordCreateBranchActivity(owner, repository, userName, branchName)
|
||||||
|
recordPushActivity(owner, repository, userName, branchName, newCommits)
|
||||||
}
|
}
|
||||||
case ReceiveCommand.Type.UPDATE => recordPushActivity(owner, repository, userName, refName(2), newCommits)
|
case ReceiveCommand.Type.UPDATE => recordPushActivity(owner, repository, userName, branchName, newCommits)
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
} else if(refName(1) == "tags"){
|
} else if(refName(1) == "tags"){
|
||||||
command.getType match {
|
command.getType match {
|
||||||
case ReceiveCommand.Type.CREATE => recordCreateTagActivity(owner, repository, userName, refName(2), newCommits)
|
case ReceiveCommand.Type.CREATE => recordCreateTagActivity(owner, repository, userName, branchName, newCommits)
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user