On Thu, Dec 6, 2012 at 1:38 PM, Maxim Khitrov <[email protected]> wrote:
> Hello,
>
> I'd like to have a consistent username across all repositories that
> I'm working with, but without modifying USER or USERNAME environment
> variables. These variables are used by other applications, so
> modifying them is not a good idea. Would it be possible to introduce
> an additional check for "FOSSIL_USER" environment variable, which
> would override the values in USER and USERNAME? The patch is below.
>
> - Max
Updated patch to check FOSSIL_USER when creating the initial Setup user:
--- ./src/user.c.orig 2012-12-06 14:10:37.000000000 -0500
+++ ./src/user.c 2012-12-06 14:11:31.000000000 -0500
@@ -304,11 +304,13 @@
**
** (3) Check the default user in the repository
**
-** (4) Try the USER environment variable.
+** (4) Try the FOSSIL_USER environment variable.
**
-** (5) Try the USERNAME environment variable.
+** (5) Try the USER environment variable.
**
-** (6) Check if the user can be extracted from the remote URL.
+** (6) Try the USERNAME environment variable.
+**
+** (7) Check if the user can be extracted from the remote URL.
**
** The user name is stored in g.zLogin. The uid is in g.userUid.
*/
@@ -328,6 +330,8 @@
if( attempt_user(db_get("default-user", 0)) ) return;
+ if( attempt_user(fossil_getenv("FOSSIL_USER")) ) return;
+
if( attempt_user(fossil_getenv("USER")) ) return;
if( attempt_user(fossil_getenv("USERNAME")) ) return;
--- ./src/db.c.orig 2012-12-06 14:27:36.000000000 -0500
+++ ./src/db.c 2012-12-06 14:27:42.000000000 -0500
@@ -1212,6 +1212,9 @@
zUser = db_get("default-user", 0);
}
if( zUser==0 ){
+ zUser = fossil_getenv("FOSSIL_USER");
+ }
+ if( zUser==0 ){
#if defined(_WIN32)
zUser = fossil_getenv("USERNAME");
#else
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users