{"thread":{"id":"17618","subject":"[PATCH JGIT] New PersonIdent of a repository is the default committer","startedAt":"2009-02-06T16:04:18Z","lastAt":"2009-02-06T16:04:18Z","messageCount":1,"participants":["Yann Simon"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"103519","messageId":"498C5F82.2040205@gmail.com","threadId":"17618","inReplyTo":null,"subject":"[PATCH JGIT] New PersonIdent of a repository is the default committer","fromName":"Yann Simon","fromEmail":"yann.simon.fr@gmail.com","sentAt":"2009-02-06T16:04:18Z","receivedAt":"2009-02-06T16:04:18Z","isPatch":true,"sender":{"key":"yann.simon.fr@gmail.com","avatar":"https://gravatar.com/avatar/2d926895d27ac988c5c8e591887e5a6a4c7036390403c74fce92519119b887a0?d=mp&s=160"},"body":"The constructor PersonIdent(Repository) uses the default values\nfrom the configuration of the repository.\n\nThe new instance gets the name and the email of the default committer.\n\nSigned-off-by: Yann Simon <yann.simon.fr@gmail.com>\n---\n .../src/org/spearce/jgit/lib/PersonIdent.java      |   26 ++++----------------\n 1 files changed, 5 insertions(+), 21 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\nindex bc5479a..fb4ab20 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java\n@@ -57,33 +57,17 @@\n \n \tprivate final int tzOffset;\n \n-\tprivate static String getHostName() {\n-\t\ttry {\n-\t\t\tjava.net.InetAddress addr = java.net.InetAddress.getLocalHost();\n-\t\t\tString hostname = addr.getCanonicalHostName();\n-\t\t\treturn hostname;\n-\t\t} catch (java.net.UnknownHostException e) {\n-\t\t\treturn \"localhost\";\n-\t\t}\n-\t}\n-\n \t/**\n-\t * Creates new PersonIdent from config info in repository, with current time\n+\t * Creates new PersonIdent from config info in repository, with current time.\n+\t * This new PersonIdent gets the info from the default committer as available\n+\t * from the configuration.\n \t * \n \t * @param repo\n \t */\n \tpublic PersonIdent(final Repository repo) {\n \t\tRepositoryConfig config = repo.getConfig();\n-\t\tString username = config.getString(\"user\", null, \"name\");\n-\t\tif (username == null)\n-\t\t\tusername = System.getProperty(\"user.name\");\n-\n-\t\tString email = config.getString(\"user\", null, \"email\");\n-\t\tif (email == null)\n-\t\t\temail = System.getProperty(\"user.name\") + \"@\" + getHostName();\n-\n-\t\tname = username;\n-\t\temailAddress = email;\n+\t\tname = config.getCommitterName();\n+\t\temailAddress = config.getCommitterEmail();\n \t\twhen = System.currentTimeMillis();\n \t\ttzOffset = TimeZone.getDefault().getOffset(when) / (60 * 1000);\n \t}\n-- \n1.6.0.4\n"}]}