Re: [PATCH JGIT] Compute the author/commiter name and email from the git configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, 3 Feb 2009, Shawn O. Pearce wrote:

> Yann Simon <yann.simon.fr@xxxxxxxxx> wrote:
>
> > @@ -308,6 +312,83 @@ public String getString(final String section, String subsection, final String na
> >  		return result;
> >  	}
> >  
> > +	/**
> > +	 * @return the author name as defined in the git variables
> > +	 *         and configurations. If no name could be found, try
> > +	 *         to use the system user name instead.
> > +	 */
> > +	public String getAuthorName() {
> > +		return getUsernameInternal(Constants.GIT_AUTHOR_NAME_KEY);
> > +	}
> > +
> > +	/**
> > +	 * @return the commiter name as defined in the git variables
> > +	 *         and configurations. If no name could be found, try
> > +	 *         to use the system user name instead.
> > +	 */
> > +	public String getCommiterName() {
> > +		return getUsernameInternal(Constants.GIT_COMMITER_NAME_KEY);
> > +	}
> > +
> > +	private String getUsernameInternal(String gitVariableKey) {
> > +		// try to get the user name from the local and global configurations.
> > +		String username = getString("user", null, "name");
> > +
> > +		if (username == null) {
> > +			// try to get the user name for the system property GIT_XXX_NAME 
> > +			username = System.getProperty(gitVariableKey);
> 
> Shouldn't that be System.getenv()?

According to

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getenv(java.lang.String)

getenv() is deprecated.  However, in later editions (Java5 and later, to 
be precise), that deprecation seems to be lifted...

Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux