Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #64 from RohanHart/master
Browse files Browse the repository at this point in the history
fixes for OS X soft links
  • Loading branch information
lukaszlenart committed Feb 29, 2016
2 parents 7b0a549 + 64ac15f commit 834a2be
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.softwaremill.codebrag.repository

import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.ResetCommand.ResetType
import org.eclipse.jgit.lib.Constants
import org.eclipse.jgit.transport.{URIish, CredentialItem, UsernamePasswordCredentialsProvider, CredentialsProvider}
import com.softwaremill.codebrag.repository.config.{RepoData, UserPassCredentials, PassphraseCredentials}

Expand All @@ -22,13 +24,14 @@ class GitRepository(val repoData: RepoData) extends Repository with RepositoryAu
protected def pullChangesForRepo() {
val git = new Git(repo)
val fetchCommand = git.fetch().setRemoveDeletedRefs(true) // need co call fetch first as pull doesn't have an option to purge removed branches
val pullCommand = git.pull()
val updateCommand = git.reset()
.setMode(ResetType.HARD)
.setRef(Constants.FETCH_HEAD)
credentialsProvider.foreach { p =>
fetchCommand.setCredentialsProvider(p)
pullCommand.setCredentialsProvider(p)
}
fetchCommand.call()
pullCommand.call()
updateCommand.call()
}

private class SshPassphraseCredentialsProvider(passphrase: String) extends CredentialsProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package com.softwaremill.codebrag.repository

import com.softwaremill.codebrag.repository.config.RepoData
import com.typesafe.scalalogging.slf4j.Logging
import org.eclipse.jgit.lib.{ObjectId, Constants}
import org.eclipse.jgit.revwalk.{RevWalk, RevCommit}
import org.eclipse.jgit.storage.file.FileRepository
import org.eclipse.jgit.errors.MissingObjectException
import com.softwaremill.codebrag.repository.config.RepoData
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib.{Constants, ObjectId}
import org.eclipse.jgit.revwalk.{RevCommit, RevWalk}

trait Repository extends Logging with RepositorySnapshotLoader with RepositoryDeltaLoader with BranchesModel {

def repoData: RepoData
def repo: FileRepository
def repo: org.eclipse.jgit.lib.Repository
val repoName = repoData.repoName

def pullChanges() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait JgitDiffExtractor {
}
}
finally {
formatter.release()
formatter.close()
}
}

Expand Down Expand Up @@ -73,7 +73,7 @@ trait JgitDiffExtractor {
newTreeId
}
finally {
inserter.release()
inserter.close()
}
}
}
4 changes: 2 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ object Dependencies {
val bson = "org.mongodb" % "bson" % "2.7.1"

val egitGithubApi = "org.eclipse.mylyn.github" % "org.eclipse.egit.github.core" % "2.1.3"
val jGit = "org.eclipse.jgit" % "org.eclipse.jgit" % "2.3.1.201302201838-r"
val jsch = "com.jcraft" % "jsch" % "0.1.51"
val jGit = "org.eclipse.jgit" % "org.eclipse.jgit" % "4.2.0.201601211800-r"
val jsch = "com.jcraft" % "jsch" % "0.1.53"
val dispatch = "net.databinder.dispatch" %% "dispatch-core" % "0.9.5"

val slick = "com.typesafe.slick" %% "slick" % "2.0.3"
Expand Down

0 comments on commit 834a2be

Please sign in to comment.