Fossil SCM

Correct inability to use certain commands after doing (open --empty), as reported in [forum:04f86a038c|forum post 04f86a038c] and caused by [4d8c30265b].

stephan 2023-09-09 15:05 trunk
Commit 1ef6499a9af8d438ee5a82582b65e7bfa31b825d679900e57d1a6a95b8fbf878
2 files changed +1 -1 +7 -5
+1 -1
--- src/db.c
+++ src/db.c
@@ -2541,11 +2541,11 @@
25412541
while( n>0 && zPwd[n-1]=='/' ){
25422542
n--;
25432543
zPwd[n] = 0;
25442544
}
25452545
g.zLocalRoot = mprintf("%s/", zPwd);
2546
- g.localOpen = db_lget_int("checkout", -1);
2546
+ g.localOpen = 1;
25472547
db_open_repository(zDbName);
25482548
return 1;
25492549
}
25502550
}
25512551
if( bRootOnly ) break;
25522552
--- src/db.c
+++ src/db.c
@@ -2541,11 +2541,11 @@
2541 while( n>0 && zPwd[n-1]=='/' ){
2542 n--;
2543 zPwd[n] = 0;
2544 }
2545 g.zLocalRoot = mprintf("%s/", zPwd);
2546 g.localOpen = db_lget_int("checkout", -1);
2547 db_open_repository(zDbName);
2548 return 1;
2549 }
2550 }
2551 if( bRootOnly ) break;
2552
--- src/db.c
+++ src/db.c
@@ -2541,11 +2541,11 @@
2541 while( n>0 && zPwd[n-1]=='/' ){
2542 n--;
2543 zPwd[n] = 0;
2544 }
2545 g.zLocalRoot = mprintf("%s/", zPwd);
2546 g.localOpen = 1;
2547 db_open_repository(zDbName);
2548 return 1;
2549 }
2550 }
2551 if( bRootOnly ) break;
2552
+7 -5
--- src/name.c
+++ src/name.c
@@ -399,10 +399,11 @@
399399
** hexadecimal identifier assigned to tickets and events. Those identifiers
400400
** live in a separate namespace.
401401
*/
402402
int symbolic_name_to_rid(const char *zTag, const char *zType){
403403
int rid = 0;
404
+ int ridCkout = 0;
404405
int nTag;
405406
int i;
406407
int startOfBranch = 0;
407408
const char *zXTag; /* zTag with optional [...] removed */
408409
int nXTag; /* Size of zXTag */
@@ -436,20 +437,21 @@
436437
if( rid ) return rid;
437438
}
438439
439440
/* special keywords: "prev", "previous", "current", "ckout", and
440441
** "next" */
441
- if( g.localOpen>0 && (zType[0]=='*' || isCheckin!=0) ){
442
- const int vid = g.localOpen;
442
+ if( (zType[0]=='*' || isCheckin!=0)
443
+ && 0>(ridCkout = db_lget_int("checkout",0)) ){
443444
if( fossil_strcmp(zTag, "current")==0 ){
444
- rid = vid;
445
+ rid = ridCkout;
445446
}else if( fossil_strcmp(zTag, "prev")==0
446447
|| fossil_strcmp(zTag, "previous")==0 ){
447
- rid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", vid);
448
+ rid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim",
449
+ ridCkout);
448450
}else if( fossil_strcmp(zTag, "next")==0 ){
449451
rid = db_int(0, "SELECT cid FROM plink WHERE pid=%d"
450
- " ORDER BY isprim DESC, mtime DESC", vid);
452
+ " ORDER BY isprim DESC, mtime DESC", ridCkout);
451453
}else if( isCheckin>1 && fossil_strcmp(zTag, "ckout")==0 ){
452454
rid = RID_CKOUT;
453455
}
454456
if( rid ) return rid;
455457
}
456458
--- src/name.c
+++ src/name.c
@@ -399,10 +399,11 @@
399 ** hexadecimal identifier assigned to tickets and events. Those identifiers
400 ** live in a separate namespace.
401 */
402 int symbolic_name_to_rid(const char *zTag, const char *zType){
403 int rid = 0;
 
404 int nTag;
405 int i;
406 int startOfBranch = 0;
407 const char *zXTag; /* zTag with optional [...] removed */
408 int nXTag; /* Size of zXTag */
@@ -436,20 +437,21 @@
436 if( rid ) return rid;
437 }
438
439 /* special keywords: "prev", "previous", "current", "ckout", and
440 ** "next" */
441 if( g.localOpen>0 && (zType[0]=='*' || isCheckin!=0) ){
442 const int vid = g.localOpen;
443 if( fossil_strcmp(zTag, "current")==0 ){
444 rid = vid;
445 }else if( fossil_strcmp(zTag, "prev")==0
446 || fossil_strcmp(zTag, "previous")==0 ){
447 rid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", vid);
 
448 }else if( fossil_strcmp(zTag, "next")==0 ){
449 rid = db_int(0, "SELECT cid FROM plink WHERE pid=%d"
450 " ORDER BY isprim DESC, mtime DESC", vid);
451 }else if( isCheckin>1 && fossil_strcmp(zTag, "ckout")==0 ){
452 rid = RID_CKOUT;
453 }
454 if( rid ) return rid;
455 }
456
--- src/name.c
+++ src/name.c
@@ -399,10 +399,11 @@
399 ** hexadecimal identifier assigned to tickets and events. Those identifiers
400 ** live in a separate namespace.
401 */
402 int symbolic_name_to_rid(const char *zTag, const char *zType){
403 int rid = 0;
404 int ridCkout = 0;
405 int nTag;
406 int i;
407 int startOfBranch = 0;
408 const char *zXTag; /* zTag with optional [...] removed */
409 int nXTag; /* Size of zXTag */
@@ -436,20 +437,21 @@
437 if( rid ) return rid;
438 }
439
440 /* special keywords: "prev", "previous", "current", "ckout", and
441 ** "next" */
442 if( (zType[0]=='*' || isCheckin!=0)
443 && 0>(ridCkout = db_lget_int("checkout",0)) ){
444 if( fossil_strcmp(zTag, "current")==0 ){
445 rid = ridCkout;
446 }else if( fossil_strcmp(zTag, "prev")==0
447 || fossil_strcmp(zTag, "previous")==0 ){
448 rid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim",
449 ridCkout);
450 }else if( fossil_strcmp(zTag, "next")==0 ){
451 rid = db_int(0, "SELECT cid FROM plink WHERE pid=%d"
452 " ORDER BY isprim DESC, mtime DESC", ridCkout);
453 }else if( isCheckin>1 && fossil_strcmp(zTag, "ckout")==0 ){
454 rid = RID_CKOUT;
455 }
456 if( rid ) return rid;
457 }
458

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button