Skip to content

Commit

Permalink
Don't attempt to resolve hostname for git init
Browse files Browse the repository at this point in the history
During initialization JGit may attempt to resolve hostname. On some
systems this can take more than desired triggering timeouts.
This change does two things:
- sets the default committer for changes, lack of which probably
  triggered the check
- sets the default hostname to `localhost` (we don't care), in case
  something else in JGit still wants to resolve hostname

Closes #6447.
  • Loading branch information
hubertp committed Apr 28, 2023
1 parent 0dc9f37 commit 18dbb43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class EmptyUserConfigReader extends SystemReader {

/** @inheritdoc */
override def getHostname: String =
proxy.getHostname
"localhost"

/** @inheritdoc */
override def getenv(variable: String): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private class Git(ensoDataDirectory: Option[Path], asyncInit: Boolean)
.setAll(true)
.setMessage("Initial commit")
.setAuthor(AuthorName, AuthorEmail)
.setCommitter(AuthorName, AuthorEmail)
.setNoVerify(true)
.call()
()
Expand Down Expand Up @@ -166,6 +167,7 @@ private class Git(ensoDataDirectory: Option[Path], asyncInit: Boolean)
.commit()
.setMessage(commitName)
.setAuthor(AuthorName, AuthorEmail)
.setCommitter(AuthorName, AuthorEmail)
.call()
RepoCommit(revCommit.getName(), revCommit.getShortMessage())
}.mapError(errorHandling)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,7 @@ class VcsManagerTest extends BaseServerTest with RetrySpec with FlakySpec {
.setAll(true)
.setMessage("Initial commit")
.setAuthor("Enso VCS", "vcs@enso.io")
.setCommitter("Enso VCS", "vcs@enso.io")
.call()
test(client)
}
Expand Down Expand Up @@ -1491,7 +1492,11 @@ class VcsManagerTest extends BaseServerTest with RetrySpec with FlakySpec {

def commit(root: File, msg: String): RevCommit = {
val jgit = new JGit(repository(root.toPath))
jgit.commit.setMessage(msg).setAuthor("Enso VCS", "vcs@enso.io").call()
jgit.commit
.setMessage(msg)
.setAuthor("Enso VCS", "vcs@enso.io")
.setCommitter("Enso VCS", "vcs@enso.io")
.call()
}

def add(root: File, paths: Path*): Boolean = {
Expand Down

0 comments on commit 18dbb43

Please sign in to comment.