From: "Shawn O. Pearce" <spearce@spearce•org>
To: Yann Simon <yann.simon.fr@gmail•com>
Cc: Robin Rosenberg <robin.rosenberg.lists@dewire•com>,
git <git@vger•kernel.org>
Subject: Re: [PATCH JGIT] Propose author and committer in the commit dialog
Date: Fri, 6 Feb 2009 07:38:49 -0800 [thread overview]
Message-ID: <20090206153849.GN26880@spearce.org> (raw)
In-Reply-To: <498C2BE5.3010602@gmail.com>
Yann Simon <yann.simon.fr@gmail•com> wrote:
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
> index bc5479a..8438683 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PersonIdent.java
> @@ -57,16 +57,6 @@
>
> private final int tzOffset;
>
> - private static String getHostName() {
> - try {
> - java.net.InetAddress addr = java.net.InetAddress.getLocalHost();
> - String hostname = addr.getCanonicalHostName();
> - return hostname;
> - } catch (java.net.UnknownHostException e) {
> - return "localhost";
> - }
> - }
> -
> /**
> * Creates new PersonIdent from config info in repository, with current time
> *
> @@ -74,14 +64,8 @@ private static String getHostName() {
> */
> public PersonIdent(final Repository repo) {
> RepositoryConfig config = repo.getConfig();
> - String username = config.getString("user", null, "name");
> - if (username == null)
> - username = System.getProperty("user.name");
> -
> - String email = config.getString("user", null, "email");
> - if (email == null)
> - email = System.getProperty("user.name") + "@" + getHostName();
> -
> + String username = config.getAuthorName();
> + String email = config.getAuthorEmail();
> name = username;
> emailAddress = email;
> when = System.currentTimeMillis();
Heh. I meant to write this patch myself yesterday but got
sidetracked and forgot. Thanks.
Its unrelated to the other changes you were making. Please submit
it as its own patch.
Aren't the local "username" and "email" variables now redundant?
Can't we just assign directly to the fields in the object?
Also, I think you should be using getCommitter{Name,Email} here
by default. Sometimes people override the GIT_AUTHOR_* variables
in order to apply patches from others, but they almost never set the
GIT_COMMITTER_* variables. We're using this constructor to create an
identity for use in commit objects, tag objects, or for the reflog.
All three prefer the committer name over the author name.
--
Shawn.
next prev parent reply other threads:[~2009-02-06 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-06 12:24 [PATCH JGIT] Propose author and committer in the commit dialog Yann Simon
2009-02-06 15:38 ` Shawn O. Pearce [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-02-06 16:03 Yann Simon
2009-02-08 20:24 ` Shawn O. Pearce
2009-02-09 13:51 Yann Simon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090206153849.GN26880@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=robin.rosenberg.lists@dewire$(echo .)com \
--cc=yann.simon.fr@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox