Merge branch 'stable'

* stable:
  Fix recognition of reviewers in commit message tags
  Allow user name to be cleared when unset in LDAP
This commit is contained in:
Shawn O. Pearce
2010-05-04 17:38:55 -07:00
5 changed files with 36 additions and 6 deletions

View File

@@ -25,13 +25,26 @@ might not even be supported by the local JRE. In such cases the
ISO-8859-1 character set is used as a fallback, so the file content
is still visible.
* Update JGit to 0.7.1.34-gf36df5d to fix empty tree bug
* issue 553 Bugs sometimes added as change reviewers
+
Bug references were sometimes added as an 'Anonymous Coward' change
reviewer when the line used to mention the bug in the commit message
was the same length as 'Signed-off-by'. Fixed.
* Update JGit to 0.7.1.46-gdd63f5c to fix empty tree bug
+
Repositories which contained an empty tree object (very uncommon, its
technically a bug to produce a repository like this) wouldn't clone
properly from the embedded Gerrit SSH or HTTP daemon. Fixed upstream
in JGit 0.7.0, but we never picked up the bug fix release.
* Allow LDAP to unset the user name
+
If the user name is configured to be set only by the LDAP directory,
and an account has a user name, but the name is no longer present
in the directory, Gerrit crashed during sign-in while trying to
clear out the user name. Fixed.
Documentation Corrections
~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -45,8 +45,9 @@ public class AccountResolver {
* Locate exactly one account matching the name or name/email string.
*
* @param nameOrEmail a string of the format
* "Full Name <email@example>", or just the email address
* ("email@example"), or a full name, or an account id.
* "Full Name <email@example>", just the email address
* ("email@example"), a full name ("Full Name"), or an account id
* ("18419").
* @return the single account that matches; null if no account matches or
* there are multiple candidates.
*/
@@ -60,6 +61,20 @@ public class AccountResolver {
return byId.get(Account.Id.parse(nameOrEmail)).getAccount();
}
return findByNameOrEmail(nameOrEmail);
}
/**
* Locate exactly one account matching the name or name/email string.
*
* @param nameOrEmail a string of the format
* "Full Name <email@example>", just the email address
* ("email@example"), a full name ("Full Name").
* @return the single account that matches; null if no account matches or
* there are multiple candidates.
*/
public Account findByNameOrEmail(final String nameOrEmail)
throws OrmException {
final int lt = nameOrEmail.indexOf('<');
final int gt = nameOrEmail.indexOf('>');
if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) {

View File

@@ -36,6 +36,8 @@ import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
/** Operation to change the username of an account. */
public class ChangeUserName implements Callable<VoidResult> {
private static final Pattern USER_NAME_PATTERN =
@@ -77,7 +79,7 @@ public class ChangeUserName implements Callable<VoidResult> {
final SshKeyCache sshKeyCache,
@Assisted final ReviewDb db, @Assisted final IdentifiedUser user,
@Assisted final String newUsername) {
@Nullable @Assisted final String newUsername) {
this.accountCache = accountCache;
this.sshKeyCache = sshKeyCache;

View File

@@ -396,7 +396,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
private Account.Id toAccountId(final String nameOrEmail) throws OrmException,
NoSuchAccountException {
final Account a = accountResolver.find(nameOrEmail);
final Account a = accountResolver.findByNameOrEmail(nameOrEmail);
if (a == null) {
throw new NoSuchAccountException("\"" + nameOrEmail
+ "\" is not registered");

View File

@@ -46,7 +46,7 @@ limitations under the License.
</issueManagement>
<properties>
<jgitVersion>0.7.1.34-gf36df5d</jgitVersion>
<jgitVersion>0.7.1.46-gdd63f5c</jgitVersion>
<gwtormVersion>1.1.4</gwtormVersion>
<gwtjsonrpcVersion>1.2.2</gwtjsonrpcVersion>
<gwtexpuiVersion>1.2.1</gwtexpuiVersion>