Fossil SCM
Merge the selectRemoteUser branch into trunk, so that now the username in the remote_url is a potential source of the user name.
Commit
24b2c6688a9fe574bbbb7ccb9a9e84395364e9ee
Parent
5f13a2a6c6334b3…
1 file changed
+10
+10
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -306,13 +306,17 @@ | ||
| 306 | 306 | ** |
| 307 | 307 | ** (4) Try the USER environment variable. |
| 308 | 308 | ** |
| 309 | 309 | ** (5) Try the USERNAME environment variable. |
| 310 | 310 | ** |
| 311 | +** (6) Check if the user can be extracted from the remote URL. | |
| 312 | +** | |
| 311 | 313 | ** The user name is stored in g.zLogin. The uid is in g.userUid. |
| 312 | 314 | */ |
| 313 | 315 | void user_select(void){ |
| 316 | + char *zUrl; | |
| 317 | + | |
| 314 | 318 | if( g.userUid ) return; |
| 315 | 319 | if( g.zLogin ){ |
| 316 | 320 | if( attempt_user(g.zLogin)==0 ){ |
| 317 | 321 | fossil_fatal("no such user: %s", g.zLogin); |
| 318 | 322 | }else{ |
| @@ -325,10 +329,16 @@ | ||
| 325 | 329 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 326 | 330 | |
| 327 | 331 | if( attempt_user(fossil_getenv("USER")) ) return; |
| 328 | 332 | |
| 329 | 333 | if( attempt_user(fossil_getenv("USERNAME")) ) return; |
| 334 | + | |
| 335 | + zUrl = db_get("last-sync-url", 0); | |
| 336 | + if( zUrl ){ | |
| 337 | + url_parse(zUrl); | |
| 338 | + if( attempt_user(g.urlUser) ) return; | |
| 339 | + } | |
| 330 | 340 | |
| 331 | 341 | fossil_print( |
| 332 | 342 | "Cannot figure out who you are! Consider using the --user\n" |
| 333 | 343 | "command line option, setting your USER environment variable,\n" |
| 334 | 344 | "or setting a default user with \"fossil user default USER\".\n" |
| 335 | 345 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -306,13 +306,17 @@ | |
| 306 | ** |
| 307 | ** (4) Try the USER environment variable. |
| 308 | ** |
| 309 | ** (5) Try the USERNAME environment variable. |
| 310 | ** |
| 311 | ** The user name is stored in g.zLogin. The uid is in g.userUid. |
| 312 | */ |
| 313 | void user_select(void){ |
| 314 | if( g.userUid ) return; |
| 315 | if( g.zLogin ){ |
| 316 | if( attempt_user(g.zLogin)==0 ){ |
| 317 | fossil_fatal("no such user: %s", g.zLogin); |
| 318 | }else{ |
| @@ -325,10 +329,16 @@ | |
| 325 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 326 | |
| 327 | if( attempt_user(fossil_getenv("USER")) ) return; |
| 328 | |
| 329 | if( attempt_user(fossil_getenv("USERNAME")) ) return; |
| 330 | |
| 331 | fossil_print( |
| 332 | "Cannot figure out who you are! Consider using the --user\n" |
| 333 | "command line option, setting your USER environment variable,\n" |
| 334 | "or setting a default user with \"fossil user default USER\".\n" |
| 335 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -306,13 +306,17 @@ | |
| 306 | ** |
| 307 | ** (4) Try the USER environment variable. |
| 308 | ** |
| 309 | ** (5) Try the USERNAME environment variable. |
| 310 | ** |
| 311 | ** (6) Check if the user can be extracted from the remote URL. |
| 312 | ** |
| 313 | ** The user name is stored in g.zLogin. The uid is in g.userUid. |
| 314 | */ |
| 315 | void user_select(void){ |
| 316 | char *zUrl; |
| 317 | |
| 318 | if( g.userUid ) return; |
| 319 | if( g.zLogin ){ |
| 320 | if( attempt_user(g.zLogin)==0 ){ |
| 321 | fossil_fatal("no such user: %s", g.zLogin); |
| 322 | }else{ |
| @@ -325,10 +329,16 @@ | |
| 329 | if( attempt_user(db_get("default-user", 0)) ) return; |
| 330 | |
| 331 | if( attempt_user(fossil_getenv("USER")) ) return; |
| 332 | |
| 333 | if( attempt_user(fossil_getenv("USERNAME")) ) return; |
| 334 | |
| 335 | zUrl = db_get("last-sync-url", 0); |
| 336 | if( zUrl ){ |
| 337 | url_parse(zUrl); |
| 338 | if( attempt_user(g.urlUser) ) return; |
| 339 | } |
| 340 | |
| 341 | fossil_print( |
| 342 | "Cannot figure out who you are! Consider using the --user\n" |
| 343 | "command line option, setting your USER environment variable,\n" |
| 344 | "or setting a default user with \"fossil user default USER\".\n" |
| 345 |