mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Remove some functions from ControlUtil.
This commit is contained in:
@@ -40,22 +40,14 @@ object ControlUtil {
|
||||
try f(treeWalk) finally treeWalk.release()
|
||||
|
||||
|
||||
def withTmpRefSpec[T](ref: RefSpec, git: Git)(f: RefSpec => T): T = {
|
||||
try {
|
||||
f(ref)
|
||||
} finally {
|
||||
val refUpdate = git.getRepository.updateRef(ref.getDestination)
|
||||
refUpdate.setForceUpdate(true)
|
||||
refUpdate.delete()
|
||||
}
|
||||
}
|
||||
// def withTmpRefSpec[T](ref: RefSpec, git: Git)(f: RefSpec => T): T = {
|
||||
// try {
|
||||
// f(ref)
|
||||
// } finally {
|
||||
// val refUpdate = git.getRepository.updateRef(ref.getDestination)
|
||||
// refUpdate.setForceUpdate(true)
|
||||
// refUpdate.delete()
|
||||
// }
|
||||
// }
|
||||
|
||||
def executeIf(condition: => Boolean)(action: => Unit): Boolean =
|
||||
if(condition){
|
||||
action
|
||||
true
|
||||
} else false
|
||||
|
||||
def optionIf[T](condition: => Boolean)(action: => Option[T]): Option[T] =
|
||||
if(condition) action else None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user