Index: subversion/libsvn_client/username_providers.c
===================================================================
--- subversion/libsvn_client/username_providers.c	(revision 8132)
+++ subversion/libsvn_client/username_providers.c	(working copy)
@@ -63,42 +63,69 @@
            apr_hash_t *parameters,
            apr_pool_t *pool)
 {
-  apr_hash_t *creds_hash = NULL;
-  svn_string_t *susername = NULL;
   const char *def_username = apr_hash_get (parameters, 
                                            SVN_AUTH_PARAM_DEFAULT_USERNAME,
                                            APR_HASH_KEY_STRING);
-  const char *config_dir;
 
-  config_dir = apr_hash_get (parameters,
-                             SVN_AUTH_PARAM_CONFIG_DIR,
-                             APR_HASH_KEY_STRING);
+  *username = NULL;
 
-  /* Try to load credentials from a file on disk, based on the
-     realmstring.  Don't throw an error, though: if something went
-     wrong reading the file, no big deal.  What really matters is that
-     we failed to get the creds, so allow the auth system to try the
-     next provider. */
-  svn_error_clear (svn_config_read_auth_data (&creds_hash,
-                                              SVN_AUTH_CRED_USERNAME,
-                                              pb->realmstring, config_dir,
-                                              pool));
-  if (creds_hash != NULL)
+  if (def_username)
     {
-      if (! def_username)
-        susername = apr_hash_get (creds_hash,
-                                  SVN_CLIENT__AUTHFILE_USERNAME_KEY,
-                                  APR_HASH_KEY_STRING);
-    }
+      *username = def_username;
+    } 
+  else 
+    {
+      apr_hash_t *creds_hash = NULL;
+      svn_string_t *susername = NULL;
+      const char *config_dir;
+      
+      config_dir = apr_hash_get (parameters,
+                                 SVN_AUTH_PARAM_CONFIG_DIR,
+                                 APR_HASH_KEY_STRING);
 
-    /* If we read values from disk, we want to remember those, so we
-       can avoid writing unchanged values back out again (not a
-       correctness point, just about efficiency). */
-  if (susername && susername->data)
-    pb->username = susername->data;
+      /* Try to load credentials from a file on disk, based on the
+         realmstring.  Don't throw an error, though: if something went
+         wrong reading the file, no big deal.  What really matters is that
+         we failed to get the creds, so allow the auth system to try the
+         next provider. */
+      svn_error_clear (svn_config_read_auth_data (&creds_hash,
+                                                  SVN_AUTH_CRED_USERNAME,
+                                                  pb->realmstring, config_dir,
+                                                  pool));
+      if (creds_hash != NULL)
+        {
+          susername = apr_hash_get (creds_hash,
+                                    SVN_CLIENT__AUTHFILE_USERNAME_KEY,
+                                    APR_HASH_KEY_STRING);
+        }
+
+      /* If we read values from disk, we want to remember those, so we
+         can avoid writing unchanged values back out again (not a
+         correctness point, just about efficiency). */
       
-  *username = def_username ? def_username : susername ? susername->data : NULL;
+      if (susername && susername->data)
+        {
+          pb->username = susername->data;
+          *username = susername->data;
+        }
+    }
+  
+  if (! *username)
+    {
+      char *un;
+      const char *uid_username;
+      apr_uid_t uid;
+      apr_gid_t gid;
 
+      if (! apr_uid_current (&uid, &gid, pool)
+          && ! apr_uid_name_get (&un, uid, pool))
+        svn_error_clear (svn_utf_cstring_to_utf8 (&uid_username, un, pool));
+
+      if (uid_username)
+        *username = uid_username;
+
+    }
+
   return !! *username;
 }
 
@@ -255,24 +282,10 @@
 
   /* If we're allowed to check for default usernames, do so. */
   if (first_time)
-    {
-      def_username = apr_hash_get (parameters, 
-                                   SVN_AUTH_PARAM_DEFAULT_USERNAME,
-                                   APR_HASH_KEY_STRING);
+    def_username = apr_hash_get (parameters, 
+                                 SVN_AUTH_PARAM_DEFAULT_USERNAME,
+                                 APR_HASH_KEY_STRING);
 
-      /* No default username?  Try the UID. */
-      if (! def_username)
-        {
-          char *un;
-          apr_uid_t uid;
-          apr_gid_t gid;
-         
-          if (! apr_uid_current (&uid, &gid, pool)
-              && ! apr_uid_name_get (&un, uid, pool))
-            SVN_ERR (svn_utf_cstring_to_utf8 (&def_username, un, pool));
-        }
-    }    
-
   /* If we have defaults, just build the cred here and return it.
    *
    * ### I do wonder why this is here instead of in a separate


