mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Fix branch name.
This commit is contained in:
@@ -87,7 +87,8 @@ 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){
|
||||||
val existIds = getAllCommitIds(owner, repository)
|
val existIds = getAllCommitIds(owner, repository)
|
||||||
@@ -108,20 +109,21 @@ class CommitLogHook(owner: String, repository: String, userName: String, baseURL
|
|||||||
|
|
||||||
// batch insert all new commit id
|
// batch insert all new commit id
|
||||||
insertAllCommitIds(owner, repository, newCommits.map(_.id))
|
insertAllCommitIds(owner, repository, newCommits.map(_.id))
|
||||||
|
|
||||||
// record activity
|
// record activity
|
||||||
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