Fossil SCM

Try to always honor the main-branch setting rather than hard-coding "branch".

drh 2025-10-28 14:15 trunk merge
Commit 3a6dd83947287de02d6ee1de5a9849c65b06860700a4e346797faefcbec314c8
+3 -1
--- src/branch.c
+++ src/branch.c
@@ -837,18 +837,20 @@
837837
*/
838838
static void new_brlist_page(void){
839839
Stmt q;
840840
double rNow;
841841
int show_colors = PB("colors");
842
+ char *zMainBranch;
842843
login_check_credentials();
843844
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
844845
style_set_current_feature("branch");
845846
style_header("Branches");
846847
style_adunit_config(ADUNIT_RIGHT_OK);
847848
style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
848849
849850
login_anonymous_available();
851
+ zMainBranch = db_get("main-branch", 0);
850852
851853
brlist_create_temp_table();
852854
db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC");
853855
rNow = db_double(0.0, "SELECT julianday('now')");
854856
@ <script id="brlist-data" type="application/json">\
@@ -873,11 +875,11 @@
873875
char *zAge = human_readable_age(rNow - rMtime);
874876
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
875877
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
876878
if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0);
877879
if( zBgClr==0 ){
878
- if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
880
+ if( zBranch==0 || strcmp(zBranch, zMainBranch)==0 ){
879881
zBgClr = 0;
880882
}else{
881883
zBgClr = hash_color(zBranch);
882884
}
883885
}
884886
--- src/branch.c
+++ src/branch.c
@@ -837,18 +837,20 @@
837 */
838 static void new_brlist_page(void){
839 Stmt q;
840 double rNow;
841 int show_colors = PB("colors");
 
842 login_check_credentials();
843 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
844 style_set_current_feature("branch");
845 style_header("Branches");
846 style_adunit_config(ADUNIT_RIGHT_OK);
847 style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
848
849 login_anonymous_available();
 
850
851 brlist_create_temp_table();
852 db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC");
853 rNow = db_double(0.0, "SELECT julianday('now')");
854 @ <script id="brlist-data" type="application/json">\
@@ -873,11 +875,11 @@
873 char *zAge = human_readable_age(rNow - rMtime);
874 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
875 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
876 if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0);
877 if( zBgClr==0 ){
878 if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
879 zBgClr = 0;
880 }else{
881 zBgClr = hash_color(zBranch);
882 }
883 }
884
--- src/branch.c
+++ src/branch.c
@@ -837,18 +837,20 @@
837 */
838 static void new_brlist_page(void){
839 Stmt q;
840 double rNow;
841 int show_colors = PB("colors");
842 char *zMainBranch;
843 login_check_credentials();
844 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
845 style_set_current_feature("branch");
846 style_header("Branches");
847 style_adunit_config(ADUNIT_RIGHT_OK);
848 style_submenu_checkbox("colors", "Use Branch Colors", 0, 0);
849
850 login_anonymous_available();
851 zMainBranch = db_get("main-branch", 0);
852
853 brlist_create_temp_table();
854 db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC");
855 rNow = db_double(0.0, "SELECT julianday('now')");
856 @ <script id="brlist-data" type="application/json">\
@@ -873,11 +875,11 @@
875 char *zAge = human_readable_age(rNow - rMtime);
876 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
877 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
878 if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0);
879 if( zBgClr==0 ){
880 if( zBranch==0 || strcmp(zBranch, zMainBranch)==0 ){
881 zBgClr = 0;
882 }else{
883 zBgClr = hash_color(zBranch);
884 }
885 }
886
+1 -1
--- src/browse.c
+++ src/browse.c
@@ -192,11 +192,11 @@
192192
193193
/* If a specific check-in is requested, fetch and parse it. If the
194194
** specific check-in does not exist, clear zCI. zCI==0 will cause all
195195
** files from all check-ins to be displayed.
196196
*/
197
- if( bDocDir && zCI==0 ) zCI = "trunk";
197
+ if( bDocDir && zCI==0 ) zCI = db_get("main-branch", 0);
198198
if( zCI ){
199199
pM = manifest_get_by_name(zCI, &rid);
200200
if( pM ){
201201
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
202202
isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0);
203203
--- src/browse.c
+++ src/browse.c
@@ -192,11 +192,11 @@
192
193 /* If a specific check-in is requested, fetch and parse it. If the
194 ** specific check-in does not exist, clear zCI. zCI==0 will cause all
195 ** files from all check-ins to be displayed.
196 */
197 if( bDocDir && zCI==0 ) zCI = "trunk";
198 if( zCI ){
199 pM = manifest_get_by_name(zCI, &rid);
200 if( pM ){
201 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
202 isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0);
203
--- src/browse.c
+++ src/browse.c
@@ -192,11 +192,11 @@
192
193 /* If a specific check-in is requested, fetch and parse it. If the
194 ** specific check-in does not exist, clear zCI. zCI==0 will cause all
195 ** files from all check-ins to be displayed.
196 */
197 if( bDocDir && zCI==0 ) zCI = db_get("main-branch", 0);
198 if( zCI ){
199 pM = manifest_get_by_name(zCI, &rid);
200 if( pM ){
201 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
202 isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0);
203
+2 -1
--- src/checkin.c
+++ src/checkin.c
@@ -1627,19 +1627,20 @@
16271627
int dryRunFlag /* True for a dry-run only */
16281628
){
16291629
Blob *pDesc;
16301630
char *zTags;
16311631
char *zFilename;
1632
+ char *zMainBranch = db_get("main-branch", 0);
16321633
Blob desc;
16331634
blob_init(&desc, 0, 0);
16341635
pDesc = &desc;
16351636
blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot);
16361637
blob_appendf(pDesc, "repository %s\n", g.zRepositoryName);
16371638
blob_appendf(pDesc, "user %s\n",
16381639
p->zUserOvrd ? p->zUserOvrd : login_name());
16391640
blob_appendf(pDesc, "branch %s\n",
1640
- (p->zBranch && p->zBranch[0]) ? p->zBranch : "trunk");
1641
+ (p->zBranch && p->zBranch[0]) ? p->zBranch : zMainBranch);
16411642
zTags = info_tags_of_checkin(parent_rid, 1);
16421643
if( zTags || p->azTag ){
16431644
blob_append(pDesc, "tags ", -1);
16441645
if(zTags){
16451646
blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : "");
16461647
--- src/checkin.c
+++ src/checkin.c
@@ -1627,19 +1627,20 @@
1627 int dryRunFlag /* True for a dry-run only */
1628 ){
1629 Blob *pDesc;
1630 char *zTags;
1631 char *zFilename;
 
1632 Blob desc;
1633 blob_init(&desc, 0, 0);
1634 pDesc = &desc;
1635 blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot);
1636 blob_appendf(pDesc, "repository %s\n", g.zRepositoryName);
1637 blob_appendf(pDesc, "user %s\n",
1638 p->zUserOvrd ? p->zUserOvrd : login_name());
1639 blob_appendf(pDesc, "branch %s\n",
1640 (p->zBranch && p->zBranch[0]) ? p->zBranch : "trunk");
1641 zTags = info_tags_of_checkin(parent_rid, 1);
1642 if( zTags || p->azTag ){
1643 blob_append(pDesc, "tags ", -1);
1644 if(zTags){
1645 blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : "");
1646
--- src/checkin.c
+++ src/checkin.c
@@ -1627,19 +1627,20 @@
1627 int dryRunFlag /* True for a dry-run only */
1628 ){
1629 Blob *pDesc;
1630 char *zTags;
1631 char *zFilename;
1632 char *zMainBranch = db_get("main-branch", 0);
1633 Blob desc;
1634 blob_init(&desc, 0, 0);
1635 pDesc = &desc;
1636 blob_appendf(pDesc, "checkout %s\n", g.zLocalRoot);
1637 blob_appendf(pDesc, "repository %s\n", g.zRepositoryName);
1638 blob_appendf(pDesc, "user %s\n",
1639 p->zUserOvrd ? p->zUserOvrd : login_name());
1640 blob_appendf(pDesc, "branch %s\n",
1641 (p->zBranch && p->zBranch[0]) ? p->zBranch : zMainBranch);
1642 zTags = info_tags_of_checkin(parent_rid, 1);
1643 if( zTags || p->azTag ){
1644 blob_append(pDesc, "tags ", -1);
1645 if(zTags){
1646 blob_appendf(pDesc, "%z%s", zTags, p->azTag ? ", " : "");
1647
+1 -1
--- src/checkout.c
+++ src/checkout.c
@@ -496,11 +496,11 @@
496496
verify_all_options();
497497
if( g.argc<3 || g.argc>4 ){
498498
usage("URL ?VERSION? ?OPTIONS?");
499499
}
500500
zUrl = g.argv[2];
501
- zVers = g.argc==4 ? g.argv[3] : "trunk";
501
+ zVers = g.argc==4 ? g.argv[3] : db_get("main-branch", 0);
502502
503503
/* Parse the URL of the repository */
504504
url_parse(zUrl, 0);
505505
506506
/* Construct an appropriate name for the destination directory */
507507
--- src/checkout.c
+++ src/checkout.c
@@ -496,11 +496,11 @@
496 verify_all_options();
497 if( g.argc<3 || g.argc>4 ){
498 usage("URL ?VERSION? ?OPTIONS?");
499 }
500 zUrl = g.argv[2];
501 zVers = g.argc==4 ? g.argv[3] : "trunk";
502
503 /* Parse the URL of the repository */
504 url_parse(zUrl, 0);
505
506 /* Construct an appropriate name for the destination directory */
507
--- src/checkout.c
+++ src/checkout.c
@@ -496,11 +496,11 @@
496 verify_all_options();
497 if( g.argc<3 || g.argc>4 ){
498 usage("URL ?VERSION? ?OPTIONS?");
499 }
500 zUrl = g.argv[2];
501 zVers = g.argc==4 ? g.argv[3] : db_get("main-branch", 0);
502
503 /* Parse the URL of the repository */
504 url_parse(zUrl, 0);
505
506 /* Construct an appropriate name for the destination directory */
507
--- src/descendants.c
+++ src/descendants.c
@@ -437,11 +437,11 @@
437437
int multipleFlag = find_option("multiple","m",0)!=0;
438438
const char *zWidth = find_option("width","W",1);
439439
char *zLastBr = 0;
440440
int n, width;
441441
char zLineNo[10];
442
- char * const zMainBranch = db_get("main-branch","trunk");
442
+ char *zMainBranch = db_get("main-branch", 0);
443443
444444
if( multipleFlag ) byBranch = 1;
445445
if( zWidth ){
446446
width = atoi(zWidth);
447447
if( (width!=0) && (width<=39) ){
448448
--- src/descendants.c
+++ src/descendants.c
@@ -437,11 +437,11 @@
437 int multipleFlag = find_option("multiple","m",0)!=0;
438 const char *zWidth = find_option("width","W",1);
439 char *zLastBr = 0;
440 int n, width;
441 char zLineNo[10];
442 char * const zMainBranch = db_get("main-branch","trunk");
443
444 if( multipleFlag ) byBranch = 1;
445 if( zWidth ){
446 width = atoi(zWidth);
447 if( (width!=0) && (width<=39) ){
448
--- src/descendants.c
+++ src/descendants.c
@@ -437,11 +437,11 @@
437 int multipleFlag = find_option("multiple","m",0)!=0;
438 const char *zWidth = find_option("width","W",1);
439 char *zLastBr = 0;
440 int n, width;
441 char zLineNo[10];
442 char *zMainBranch = db_get("main-branch", 0);
443
444 if( multipleFlag ) byBranch = 1;
445 if( zWidth ){
446 width = atoi(zWidth);
447 if( (width!=0) && (width<=39) ){
448
+2 -1
--- src/diff.c
+++ src/diff.c
@@ -3949,11 +3949,12 @@
39493949
** -n|--limit LIMIT LIMIT can be one of:
39503950
** N Up to N versions
39513951
** Xs As much as possible in X seconds
39523952
** none No limit
39533953
** -o|--origin VERSION The origin check-in. By default this is the
3954
-** root of the repository. Set to "trunk" or
3954
+** root of the repository. Set to the name of
3955
+** the main branch (usually "trunk") or
39553956
** similar for a reverse annotation.
39563957
** -w|--ignore-all-space Ignore white space when comparing lines
39573958
** -Z|--ignore-trailing-space Ignore whitespace at line end
39583959
**
39593960
** See also: [[info]], [[finfo]], [[timeline]]
39603961
--- src/diff.c
+++ src/diff.c
@@ -3949,11 +3949,12 @@
3949 ** -n|--limit LIMIT LIMIT can be one of:
3950 ** N Up to N versions
3951 ** Xs As much as possible in X seconds
3952 ** none No limit
3953 ** -o|--origin VERSION The origin check-in. By default this is the
3954 ** root of the repository. Set to "trunk" or
 
3955 ** similar for a reverse annotation.
3956 ** -w|--ignore-all-space Ignore white space when comparing lines
3957 ** -Z|--ignore-trailing-space Ignore whitespace at line end
3958 **
3959 ** See also: [[info]], [[finfo]], [[timeline]]
3960
--- src/diff.c
+++ src/diff.c
@@ -3949,11 +3949,12 @@
3949 ** -n|--limit LIMIT LIMIT can be one of:
3950 ** N Up to N versions
3951 ** Xs As much as possible in X seconds
3952 ** none No limit
3953 ** -o|--origin VERSION The origin check-in. By default this is the
3954 ** root of the repository. Set to the name of
3955 ** the main branch (usually "trunk") or
3956 ** similar for a reverse annotation.
3957 ** -w|--ignore-all-space Ignore white space when comparing lines
3958 ** -Z|--ignore-trailing-space Ignore whitespace at line end
3959 **
3960 ** See also: [[info]], [[finfo]], [[timeline]]
3961
+8 -5
--- src/export.c
+++ src/export.c
@@ -491,20 +491,21 @@
491491
Stmt q, q2, q3;
492492
Bag blobs, vers;
493493
unsigned int unused_mark = 1;
494494
const char *markfile_in;
495495
const char *markfile_out;
496
+ char *zMainBranch = db_get("main-branch", 0);
496497
497498
bag_init(&blobs);
498499
bag_init(&vers);
499500
500501
find_option("git", 0, 0); /* Ignore the --git option for now */
501502
markfile_in = find_option("import-marks", 0, 1);
502503
markfile_out = find_option("export-marks", 0, 1);
503504
504505
if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
505
- gexport.zTrunkName = "trunk";
506
+ gexport.zTrunkName = fossil_strdup(zMainBranch);
506507
}
507508
508509
db_find_and_open_repository(0, 2);
509510
verify_all_options();
510511
if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
@@ -629,11 +630,11 @@
629630
630631
bag_insert(&vers, ckinId);
631632
db_bind_int(&q2, ":rid", ckinId);
632633
db_step(&q2);
633634
db_reset(&q2);
634
- if( zBranch==0 || fossil_strcmp(zBranch, "trunk")==0 ){
635
+ if( zBranch==0 || fossil_strcmp(zBranch, zMainBranch)==0 ){
635636
zBranch = gexport.zTrunkName;
636637
}
637638
zMark = mark_name_from_rid(ckinId, &unused_mark);
638639
printf("commit refs/heads/");
639640
print_ref(zBranch);
@@ -857,12 +858,12 @@
857858
#define VERB_ERROR 1
858859
#define VERB_NORMAL 2
859860
#define VERB_EXTRA 3
860861
static int gitmirror_verbosity = VERB_NORMAL;
861862
862
-/* The main branch in the Git repository. The "trunk" branch of
863
-** Fossil is renamed to be this branch name.
863
+/* The main branch in the Git repository. The main branch of the
864
+** Fossil repository (usually "trunk") is renamed to be this branch name.
864865
*/
865866
static const char *gitmirror_mainbranch = 0;
866867
867868
/*
868869
** Output routine that depends on verbosity
@@ -1090,10 +1091,11 @@
10901091
int bPhantomOk; /* True if phantom files should be ignored */
10911092
char buf[24];
10921093
char *zEmail; /* Contact info for Git committer field */
10931094
int fManifest; /* Should the manifest files be included? */
10941095
int fPManifest = 0; /* OR of the manifest files for all parents */
1096
+ char *zMainBranch;
10951097
10961098
pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
10971099
if( pMan==0 ){
10981100
/* Must be a phantom. Return without doing anything, and in particular
10991101
** without creating a mark for this check-in. */
@@ -1149,11 +1151,12 @@
11491151
/* Figure out which branch this check-in is a member of */
11501152
zBranch = db_text(0,
11511153
"SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
11521154
TAG_BRANCH, rid
11531155
);
1154
- if( fossil_strcmp(zBranch,"trunk")==0 ){
1156
+ zMainBranch = db_get("main-branch", 0);
1157
+ if( fossil_strcmp(zBranch, zMainBranch)==0 ){
11551158
assert( gitmirror_mainbranch!=0 );
11561159
fossil_free(zBranch);
11571160
zBranch = fossil_strdup(gitmirror_mainbranch);
11581161
}else if( zBranch==0 ){
11591162
zBranch = mprintf("unknown");
11601163
--- src/export.c
+++ src/export.c
@@ -491,20 +491,21 @@
491 Stmt q, q2, q3;
492 Bag blobs, vers;
493 unsigned int unused_mark = 1;
494 const char *markfile_in;
495 const char *markfile_out;
 
496
497 bag_init(&blobs);
498 bag_init(&vers);
499
500 find_option("git", 0, 0); /* Ignore the --git option for now */
501 markfile_in = find_option("import-marks", 0, 1);
502 markfile_out = find_option("export-marks", 0, 1);
503
504 if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
505 gexport.zTrunkName = "trunk";
506 }
507
508 db_find_and_open_repository(0, 2);
509 verify_all_options();
510 if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
@@ -629,11 +630,11 @@
629
630 bag_insert(&vers, ckinId);
631 db_bind_int(&q2, ":rid", ckinId);
632 db_step(&q2);
633 db_reset(&q2);
634 if( zBranch==0 || fossil_strcmp(zBranch, "trunk")==0 ){
635 zBranch = gexport.zTrunkName;
636 }
637 zMark = mark_name_from_rid(ckinId, &unused_mark);
638 printf("commit refs/heads/");
639 print_ref(zBranch);
@@ -857,12 +858,12 @@
857 #define VERB_ERROR 1
858 #define VERB_NORMAL 2
859 #define VERB_EXTRA 3
860 static int gitmirror_verbosity = VERB_NORMAL;
861
862 /* The main branch in the Git repository. The "trunk" branch of
863 ** Fossil is renamed to be this branch name.
864 */
865 static const char *gitmirror_mainbranch = 0;
866
867 /*
868 ** Output routine that depends on verbosity
@@ -1090,10 +1091,11 @@
1090 int bPhantomOk; /* True if phantom files should be ignored */
1091 char buf[24];
1092 char *zEmail; /* Contact info for Git committer field */
1093 int fManifest; /* Should the manifest files be included? */
1094 int fPManifest = 0; /* OR of the manifest files for all parents */
 
1095
1096 pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
1097 if( pMan==0 ){
1098 /* Must be a phantom. Return without doing anything, and in particular
1099 ** without creating a mark for this check-in. */
@@ -1149,11 +1151,12 @@
1149 /* Figure out which branch this check-in is a member of */
1150 zBranch = db_text(0,
1151 "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
1152 TAG_BRANCH, rid
1153 );
1154 if( fossil_strcmp(zBranch,"trunk")==0 ){
 
1155 assert( gitmirror_mainbranch!=0 );
1156 fossil_free(zBranch);
1157 zBranch = fossil_strdup(gitmirror_mainbranch);
1158 }else if( zBranch==0 ){
1159 zBranch = mprintf("unknown");
1160
--- src/export.c
+++ src/export.c
@@ -491,20 +491,21 @@
491 Stmt q, q2, q3;
492 Bag blobs, vers;
493 unsigned int unused_mark = 1;
494 const char *markfile_in;
495 const char *markfile_out;
496 char *zMainBranch = db_get("main-branch", 0);
497
498 bag_init(&blobs);
499 bag_init(&vers);
500
501 find_option("git", 0, 0); /* Ignore the --git option for now */
502 markfile_in = find_option("import-marks", 0, 1);
503 markfile_out = find_option("export-marks", 0, 1);
504
505 if( !(gexport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
506 gexport.zTrunkName = fossil_strdup(zMainBranch);
507 }
508
509 db_find_and_open_repository(0, 2);
510 verify_all_options();
511 if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
@@ -629,11 +630,11 @@
630
631 bag_insert(&vers, ckinId);
632 db_bind_int(&q2, ":rid", ckinId);
633 db_step(&q2);
634 db_reset(&q2);
635 if( zBranch==0 || fossil_strcmp(zBranch, zMainBranch)==0 ){
636 zBranch = gexport.zTrunkName;
637 }
638 zMark = mark_name_from_rid(ckinId, &unused_mark);
639 printf("commit refs/heads/");
640 print_ref(zBranch);
@@ -857,12 +858,12 @@
858 #define VERB_ERROR 1
859 #define VERB_NORMAL 2
860 #define VERB_EXTRA 3
861 static int gitmirror_verbosity = VERB_NORMAL;
862
863 /* The main branch in the Git repository. The main branch of the
864 ** Fossil repository (usually "trunk") is renamed to be this branch name.
865 */
866 static const char *gitmirror_mainbranch = 0;
867
868 /*
869 ** Output routine that depends on verbosity
@@ -1090,10 +1091,11 @@
1091 int bPhantomOk; /* True if phantom files should be ignored */
1092 char buf[24];
1093 char *zEmail; /* Contact info for Git committer field */
1094 int fManifest; /* Should the manifest files be included? */
1095 int fPManifest = 0; /* OR of the manifest files for all parents */
1096 char *zMainBranch;
1097
1098 pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
1099 if( pMan==0 ){
1100 /* Must be a phantom. Return without doing anything, and in particular
1101 ** without creating a mark for this check-in. */
@@ -1149,11 +1151,12 @@
1151 /* Figure out which branch this check-in is a member of */
1152 zBranch = db_text(0,
1153 "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d",
1154 TAG_BRANCH, rid
1155 );
1156 zMainBranch = db_get("main-branch", 0);
1157 if( fossil_strcmp(zBranch, zMainBranch)==0 ){
1158 assert( gitmirror_mainbranch!=0 );
1159 fossil_free(zBranch);
1160 zBranch = fossil_strdup(gitmirror_mainbranch);
1161 }else if( zBranch==0 ){
1162 zBranch = mprintf("unknown");
1163
+1 -1
--- src/fileedit.c
+++ src/fileedit.c
@@ -833,11 +833,11 @@
833833
}
834834
if(zRevision==0 || zRevision[0]==0){
835835
if(g.localOpen/*check-out*/){
836836
zRevision = db_lget("checkout-hash", 0)/*leak*/;
837837
}else{
838
- zRevision = "trunk";
838
+ zRevision = db_get("main-branch", 0);
839839
}
840840
}
841841
name_to_uuid2(zRevision, "ci", &cimi.zParentUuid);
842842
if(cimi.zParentUuid==0){
843843
fossil_fatal("Cannot determine version to commit to.");
844844
--- src/fileedit.c
+++ src/fileedit.c
@@ -833,11 +833,11 @@
833 }
834 if(zRevision==0 || zRevision[0]==0){
835 if(g.localOpen/*check-out*/){
836 zRevision = db_lget("checkout-hash", 0)/*leak*/;
837 }else{
838 zRevision = "trunk";
839 }
840 }
841 name_to_uuid2(zRevision, "ci", &cimi.zParentUuid);
842 if(cimi.zParentUuid==0){
843 fossil_fatal("Cannot determine version to commit to.");
844
--- src/fileedit.c
+++ src/fileedit.c
@@ -833,11 +833,11 @@
833 }
834 if(zRevision==0 || zRevision[0]==0){
835 if(g.localOpen/*check-out*/){
836 zRevision = db_lget("checkout-hash", 0)/*leak*/;
837 }else{
838 zRevision = db_get("main-branch", 0);
839 }
840 }
841 name_to_uuid2(zRevision, "ci", &cimi.zParentUuid);
842 if(cimi.zParentUuid==0){
843 fossil_fatal("Cannot determine version to commit to.");
844
+5 -3
--- src/finfo.c
+++ src/finfo.c
@@ -176,10 +176,11 @@
176176
const char *zFilename;
177177
const char *zLimit;
178178
const char *zWidth;
179179
const char *zOffset;
180180
int iLimit, iOffset, iBrief, iWidth;
181
+ char *zMainBranch = db_get("main-branch", 0);
181182
182183
if( find_option("log","l",0) ){
183184
/* this is the default, no-op */
184185
}
185186
zLimit = find_option("limit","n",1);
@@ -239,11 +240,11 @@
239240
const char *zDate = db_column_text(&q, 2);
240241
const char *zCom = db_column_text(&q, 3);
241242
const char *zUser = db_column_text(&q, 4);
242243
const char *zBr = db_column_text(&q, 5);
243244
char *zOut;
244
- if( zBr==0 ) zBr = "trunk";
245
+ if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
245246
if( iBrief == 0 ){
246247
fossil_print("%s ", zDate);
247248
zOut = mprintf(
248249
"[%S] %s (user: %s, artifact: [%S], branch: %s)",
249250
zCiUuid, zCom, zUser, zFileUuid, zBr);
@@ -376,10 +377,11 @@
376377
int tmFlags = 0; /* Viewing mode */
377378
const char *zStyle; /* Viewing mode name */
378379
const char *zMark; /* Mark this version of the file */
379380
int selRid = 0; /* RID of the marked file version */
380381
int mxfnid; /* Maximum filename.fnid value */
382
+ char *zMainBranch = db_get("main-branch", 0);
381383
382384
login_check_credentials();
383385
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
384386
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
385387
ridCi = zCI ? name_to_rid_www("ci") : 0;
@@ -633,15 +635,15 @@
633635
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
634636
aParent[nParent] = db_column_int64(&qparent, 0);
635637
nParent++;
636638
}
637639
db_reset(&qparent);
638
- if( zBr==0 ) zBr = "trunk";
640
+ if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
639641
if( uBg ){
640642
zBgClr = user_color(zUser);
641643
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
642
- zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr);
644
+ zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr);
643645
}else if( zBgClr ){
644646
zBgClr = reasonable_bg_color(zBgClr,0);
645647
}
646648
gidx = graph_add_row(pGraph,
647649
frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000,
648650
--- src/finfo.c
+++ src/finfo.c
@@ -176,10 +176,11 @@
176 const char *zFilename;
177 const char *zLimit;
178 const char *zWidth;
179 const char *zOffset;
180 int iLimit, iOffset, iBrief, iWidth;
 
181
182 if( find_option("log","l",0) ){
183 /* this is the default, no-op */
184 }
185 zLimit = find_option("limit","n",1);
@@ -239,11 +240,11 @@
239 const char *zDate = db_column_text(&q, 2);
240 const char *zCom = db_column_text(&q, 3);
241 const char *zUser = db_column_text(&q, 4);
242 const char *zBr = db_column_text(&q, 5);
243 char *zOut;
244 if( zBr==0 ) zBr = "trunk";
245 if( iBrief == 0 ){
246 fossil_print("%s ", zDate);
247 zOut = mprintf(
248 "[%S] %s (user: %s, artifact: [%S], branch: %s)",
249 zCiUuid, zCom, zUser, zFileUuid, zBr);
@@ -376,10 +377,11 @@
376 int tmFlags = 0; /* Viewing mode */
377 const char *zStyle; /* Viewing mode name */
378 const char *zMark; /* Mark this version of the file */
379 int selRid = 0; /* RID of the marked file version */
380 int mxfnid; /* Maximum filename.fnid value */
 
381
382 login_check_credentials();
383 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
384 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
385 ridCi = zCI ? name_to_rid_www("ci") : 0;
@@ -633,15 +635,15 @@
633 while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
634 aParent[nParent] = db_column_int64(&qparent, 0);
635 nParent++;
636 }
637 db_reset(&qparent);
638 if( zBr==0 ) zBr = "trunk";
639 if( uBg ){
640 zBgClr = user_color(zUser);
641 }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
642 zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr);
643 }else if( zBgClr ){
644 zBgClr = reasonable_bg_color(zBgClr,0);
645 }
646 gidx = graph_add_row(pGraph,
647 frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000,
648
--- src/finfo.c
+++ src/finfo.c
@@ -176,10 +176,11 @@
176 const char *zFilename;
177 const char *zLimit;
178 const char *zWidth;
179 const char *zOffset;
180 int iLimit, iOffset, iBrief, iWidth;
181 char *zMainBranch = db_get("main-branch", 0);
182
183 if( find_option("log","l",0) ){
184 /* this is the default, no-op */
185 }
186 zLimit = find_option("limit","n",1);
@@ -239,11 +240,11 @@
240 const char *zDate = db_column_text(&q, 2);
241 const char *zCom = db_column_text(&q, 3);
242 const char *zUser = db_column_text(&q, 4);
243 const char *zBr = db_column_text(&q, 5);
244 char *zOut;
245 if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
246 if( iBrief == 0 ){
247 fossil_print("%s ", zDate);
248 zOut = mprintf(
249 "[%S] %s (user: %s, artifact: [%S], branch: %s)",
250 zCiUuid, zCom, zUser, zFileUuid, zBr);
@@ -376,10 +377,11 @@
377 int tmFlags = 0; /* Viewing mode */
378 const char *zStyle; /* Viewing mode name */
379 const char *zMark; /* Mark this version of the file */
380 int selRid = 0; /* RID of the marked file version */
381 int mxfnid; /* Maximum filename.fnid value */
382 char *zMainBranch = db_get("main-branch", 0);
383
384 login_check_credentials();
385 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
386 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
387 ridCi = zCI ? name_to_rid_www("ci") : 0;
@@ -633,15 +635,15 @@
635 while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
636 aParent[nParent] = db_column_int64(&qparent, 0);
637 nParent++;
638 }
639 db_reset(&qparent);
640 if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
641 if( uBg ){
642 zBgClr = user_color(zUser);
643 }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
644 zBgClr = strcmp(zBr, zMainBranch)==0 ? "" : hash_color(zBr);
645 }else if( zBgClr ){
646 zBgClr = reasonable_bg_color(zBgClr,0);
647 }
648 gidx = graph_add_row(pGraph,
649 frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000,
650
+4 -2
--- src/graph.c
+++ src/graph.c
@@ -513,10 +513,11 @@
513513
GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
514514
int i, j;
515515
u64 mask;
516516
int hasDup = 0; /* True if one or more isDup entries */
517517
const char *zTrunk;
518
+ char *zMainBranch;
518519
u8 *aMap; /* Copy of p->aiRailMap */
519520
int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
520521
int nTimewarp = 0;
521522
int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN;
522523
@@ -706,13 +707,14 @@
706707
}
707708
708709
/* Identify rows where the primary parent is off screen. Assign
709710
** each to a rail and draw descenders downward.
710711
**
711
- ** Strive to put the "trunk" branch on far left.
712
+ ** Strive to put the main branch (usually "trunk") on far left.
712713
*/
713
- zTrunk = persistBranchName(p, "trunk");
714
+ zMainBranch = db_get("main-branch", 0);
715
+ zTrunk = persistBranchName(p, zMainBranch);
714716
for(i=0; i<2; i++){
715717
for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
716718
if( i==0 && pRow->zBranch!=zTrunk ) continue;
717719
if( pRow->iRail>=0 ) continue;
718720
if( pRow->isDup ) continue;
719721
--- src/graph.c
+++ src/graph.c
@@ -513,10 +513,11 @@
513 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
514 int i, j;
515 u64 mask;
516 int hasDup = 0; /* True if one or more isDup entries */
517 const char *zTrunk;
 
518 u8 *aMap; /* Copy of p->aiRailMap */
519 int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
520 int nTimewarp = 0;
521 int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN;
522
@@ -706,13 +707,14 @@
706 }
707
708 /* Identify rows where the primary parent is off screen. Assign
709 ** each to a rail and draw descenders downward.
710 **
711 ** Strive to put the "trunk" branch on far left.
712 */
713 zTrunk = persistBranchName(p, "trunk");
 
714 for(i=0; i<2; i++){
715 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
716 if( i==0 && pRow->zBranch!=zTrunk ) continue;
717 if( pRow->iRail>=0 ) continue;
718 if( pRow->isDup ) continue;
719
--- src/graph.c
+++ src/graph.c
@@ -513,10 +513,11 @@
513 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
514 int i, j;
515 u64 mask;
516 int hasDup = 0; /* True if one or more isDup entries */
517 const char *zTrunk;
518 char *zMainBranch;
519 u8 *aMap; /* Copy of p->aiRailMap */
520 int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
521 int nTimewarp = 0;
522 int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN;
523
@@ -706,13 +707,14 @@
707 }
708
709 /* Identify rows where the primary parent is off screen. Assign
710 ** each to a rail and draw descenders downward.
711 **
712 ** Strive to put the main branch (usually "trunk") on far left.
713 */
714 zMainBranch = db_get("main-branch", 0);
715 zTrunk = persistBranchName(p, zMainBranch);
716 for(i=0; i<2; i++){
717 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
718 if( i==0 && pRow->zBranch!=zTrunk ) continue;
719 if( pRow->iRail>=0 ) continue;
720 if( pRow->isDup ) continue;
721
+7 -5
--- src/import.c
+++ src/import.c
@@ -568,12 +568,12 @@
568568
**
569569
** (A) refs/heads/BRANCHNAME
570570
** (B) refs/tags/TAGNAME
571571
**
572572
** If pattern A is used, then the branchname used is as shown.
573
- ** Except, the "master" branch which is the default branch name in
574
- ** Git is changed to "trunk" which is the default name in Fossil.
573
+ ** Except, the "master" branch which is the default branch name in Git
574
+ ** is changed to the default main branch name in Fossil (usually "trunk")
575575
** If the pattern is B, then the new commit should be on the same
576576
** branch as its parent. And, we might need to add the TAGNAME
577577
** tag to the new commit. However, if there are multiple instances
578578
** of pattern B with the same TAGNAME, then only put the tag on the
579579
** last commit that holds that tag.
@@ -1263,10 +1263,11 @@
12631263
** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree.
12641264
*/
12651265
static int svn_parse_path(char *zPath, char **zFile, int *type){
12661266
char *zBranch = 0;
12671267
int branchId = 0;
1268
+ char *zMainBranch = db_get("main-branch", 0);
12681269
if( gsvn.azIgnTree ){
12691270
const char **pzIgnTree;
12701271
unsigned nPath = strlen(zPath);
12711272
for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){
12721273
const char *zIgn = *pzIgnTree;
@@ -1278,17 +1279,17 @@
12781279
}
12791280
}
12801281
*type = SVN_UNKNOWN;
12811282
*zFile = 0;
12821283
if( gsvn.lenTrunk==0 ){
1283
- zBranch = "trunk";
1284
+ zBranch = fossil_strdup(zMainBranch);
12841285
*zFile = zPath;
12851286
*type = SVN_TRUNK;
12861287
}else
12871288
if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
12881289
if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){
1289
- zBranch = "trunk";
1290
+ zBranch = fossil_strdup(zMainBranch);
12901291
*zFile = zPath+gsvn.lenTrunk;
12911292
*type = SVN_TRUNK;
12921293
}else{
12931294
zBranch = 0;
12941295
*type = SVN_UNKNOWN;
@@ -1727,10 +1728,11 @@
17271728
int svnFlag = find_option("svn", 0, 0)!=0;
17281729
int gitFlag = find_option("git", 0, 0)!=0;
17291730
int omitRebuild = find_option("no-rebuild",0,0)!=0;
17301731
int omitVacuum = find_option("no-vacuum",0,0)!=0;
17311732
const char *zDefaultUser = find_option("admin-user","A",1);
1733
+ char *zMainBranch = db_get("main-branch", 0);
17321734
17331735
/* Options common to all input formats */
17341736
int incrFlag = find_option("incremental", "i", 0)!=0;
17351737
17361738
/* Options for --svn only */
@@ -1770,11 +1772,11 @@
17701772
*renOpt->varSuf = renOpt->zDefaultSuf;
17711773
}
17721774
}
17731775
}
17741776
if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
1775
- gimport.zTrunkName = "trunk";
1777
+ gimport.zTrunkName = fossil_strdup(zMainBranch);
17761778
}
17771779
17781780
if( svnFlag ){
17791781
/* Get --svn related options here, so verify_all_options() fails when
17801782
* svn-only options are specified with --git
17811783
--- src/import.c
+++ src/import.c
@@ -568,12 +568,12 @@
568 **
569 ** (A) refs/heads/BRANCHNAME
570 ** (B) refs/tags/TAGNAME
571 **
572 ** If pattern A is used, then the branchname used is as shown.
573 ** Except, the "master" branch which is the default branch name in
574 ** Git is changed to "trunk" which is the default name in Fossil.
575 ** If the pattern is B, then the new commit should be on the same
576 ** branch as its parent. And, we might need to add the TAGNAME
577 ** tag to the new commit. However, if there are multiple instances
578 ** of pattern B with the same TAGNAME, then only put the tag on the
579 ** last commit that holds that tag.
@@ -1263,10 +1263,11 @@
1263 ** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree.
1264 */
1265 static int svn_parse_path(char *zPath, char **zFile, int *type){
1266 char *zBranch = 0;
1267 int branchId = 0;
 
1268 if( gsvn.azIgnTree ){
1269 const char **pzIgnTree;
1270 unsigned nPath = strlen(zPath);
1271 for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){
1272 const char *zIgn = *pzIgnTree;
@@ -1278,17 +1279,17 @@
1278 }
1279 }
1280 *type = SVN_UNKNOWN;
1281 *zFile = 0;
1282 if( gsvn.lenTrunk==0 ){
1283 zBranch = "trunk";
1284 *zFile = zPath;
1285 *type = SVN_TRUNK;
1286 }else
1287 if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
1288 if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){
1289 zBranch = "trunk";
1290 *zFile = zPath+gsvn.lenTrunk;
1291 *type = SVN_TRUNK;
1292 }else{
1293 zBranch = 0;
1294 *type = SVN_UNKNOWN;
@@ -1727,10 +1728,11 @@
1727 int svnFlag = find_option("svn", 0, 0)!=0;
1728 int gitFlag = find_option("git", 0, 0)!=0;
1729 int omitRebuild = find_option("no-rebuild",0,0)!=0;
1730 int omitVacuum = find_option("no-vacuum",0,0)!=0;
1731 const char *zDefaultUser = find_option("admin-user","A",1);
 
1732
1733 /* Options common to all input formats */
1734 int incrFlag = find_option("incremental", "i", 0)!=0;
1735
1736 /* Options for --svn only */
@@ -1770,11 +1772,11 @@
1770 *renOpt->varSuf = renOpt->zDefaultSuf;
1771 }
1772 }
1773 }
1774 if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
1775 gimport.zTrunkName = "trunk";
1776 }
1777
1778 if( svnFlag ){
1779 /* Get --svn related options here, so verify_all_options() fails when
1780 * svn-only options are specified with --git
1781
--- src/import.c
+++ src/import.c
@@ -568,12 +568,12 @@
568 **
569 ** (A) refs/heads/BRANCHNAME
570 ** (B) refs/tags/TAGNAME
571 **
572 ** If pattern A is used, then the branchname used is as shown.
573 ** Except, the "master" branch which is the default branch name in Git
574 ** is changed to the default main branch name in Fossil (usually "trunk")
575 ** If the pattern is B, then the new commit should be on the same
576 ** branch as its parent. And, we might need to add the TAGNAME
577 ** tag to the new commit. However, if there are multiple instances
578 ** of pattern B with the same TAGNAME, then only put the tag on the
579 ** last commit that holds that tag.
@@ -1263,10 +1263,11 @@
1263 ** Return 0 if not a branch, tag, or trunk, or if ignored by --ignore-tree.
1264 */
1265 static int svn_parse_path(char *zPath, char **zFile, int *type){
1266 char *zBranch = 0;
1267 int branchId = 0;
1268 char *zMainBranch = db_get("main-branch", 0);
1269 if( gsvn.azIgnTree ){
1270 const char **pzIgnTree;
1271 unsigned nPath = strlen(zPath);
1272 for( pzIgnTree = gsvn.azIgnTree; *pzIgnTree; ++pzIgnTree ){
1273 const char *zIgn = *pzIgnTree;
@@ -1278,17 +1279,17 @@
1279 }
1280 }
1281 *type = SVN_UNKNOWN;
1282 *zFile = 0;
1283 if( gsvn.lenTrunk==0 ){
1284 zBranch = fossil_strdup(zMainBranch);
1285 *zFile = zPath;
1286 *type = SVN_TRUNK;
1287 }else
1288 if( strncmp(zPath, gsvn.zTrunk, gsvn.lenTrunk-1)==0 ){
1289 if( zPath[gsvn.lenTrunk-1]=='/' || zPath[gsvn.lenTrunk-1]==0 ){
1290 zBranch = fossil_strdup(zMainBranch);
1291 *zFile = zPath+gsvn.lenTrunk;
1292 *type = SVN_TRUNK;
1293 }else{
1294 zBranch = 0;
1295 *type = SVN_UNKNOWN;
@@ -1727,10 +1728,11 @@
1728 int svnFlag = find_option("svn", 0, 0)!=0;
1729 int gitFlag = find_option("git", 0, 0)!=0;
1730 int omitRebuild = find_option("no-rebuild",0,0)!=0;
1731 int omitVacuum = find_option("no-vacuum",0,0)!=0;
1732 const char *zDefaultUser = find_option("admin-user","A",1);
1733 char *zMainBranch = db_get("main-branch", 0);
1734
1735 /* Options common to all input formats */
1736 int incrFlag = find_option("incremental", "i", 0)!=0;
1737
1738 /* Options for --svn only */
@@ -1770,11 +1772,11 @@
1772 *renOpt->varSuf = renOpt->zDefaultSuf;
1773 }
1774 }
1775 }
1776 if( !(gimport.zTrunkName = find_option("rename-trunk", 0, 1)) ){
1777 gimport.zTrunkName = fossil_strdup(zMainBranch);
1778 }
1779
1780 if( svnFlag ){
1781 /* Get --svn related options here, so verify_all_options() fails when
1782 * svn-only options are specified with --git
1783
+4 -2
--- src/info.c
+++ src/info.c
@@ -1141,13 +1141,14 @@
11411141
}
11421142
@ %s(zLinks)</td></tr>
11431143
}
11441144
11451145
if( g.perm.Hyperlink ){
1146
+ char *zMainBranch = db_get("main-branch", 0);
11461147
@ <tr><th>Other&nbsp;Links:</th>
11471148
@ <td>
1148
- if( fossil_strcmp(zBrName, db_get("main-branch",0))!=0 ){
1149
+ if( fossil_strcmp(zBrName, zMainBranch)!=0 ){
11491150
@ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> |
11501151
}
11511152
@ %z(href("%R/artifact/%!S",zUuid))manifest</a>
11521153
@ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
11531154
if( g.perm.Admin ){
@@ -3717,10 +3718,11 @@
37173718
style_header("Edit Check-in [%s]", zUuid);
37183719
if( P("preview") ){
37193720
Blob suffix;
37203721
int nTag = 0;
37213722
const char *zDplyBr; /* Branch name used to determine BG color */
3723
+ char *zMainBranch = db_get("main-branch", 0);
37223724
if( zNewBrFlag[0] && zNewBranch[0] ){
37233725
zDplyBr = zNewBranch;
37243726
}else{
37253727
zDplyBr = zBranchName;
37263728
}
@@ -3729,11 +3731,11 @@
37293731
@ <table border=0>
37303732
if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
37313733
@ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));">
37323734
}else if( zColor[0] ){
37333735
@ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));">
3734
- }else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){
3736
+ }else if( zDplyBr && fossil_strcmp(zDplyBr, zMainBranch)!=0 ){
37353737
@ <tr><td style="background-color:%h(hash_color(zDplyBr));">
37363738
}else{
37373739
@ <tr><td>
37383740
}
37393741
@ %!W(blob_str(&comment))
37403742
--- src/info.c
+++ src/info.c
@@ -1141,13 +1141,14 @@
1141 }
1142 @ %s(zLinks)</td></tr>
1143 }
1144
1145 if( g.perm.Hyperlink ){
 
1146 @ <tr><th>Other&nbsp;Links:</th>
1147 @ <td>
1148 if( fossil_strcmp(zBrName, db_get("main-branch",0))!=0 ){
1149 @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> |
1150 }
1151 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
1152 @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
1153 if( g.perm.Admin ){
@@ -3717,10 +3718,11 @@
3717 style_header("Edit Check-in [%s]", zUuid);
3718 if( P("preview") ){
3719 Blob suffix;
3720 int nTag = 0;
3721 const char *zDplyBr; /* Branch name used to determine BG color */
 
3722 if( zNewBrFlag[0] && zNewBranch[0] ){
3723 zDplyBr = zNewBranch;
3724 }else{
3725 zDplyBr = zBranchName;
3726 }
@@ -3729,11 +3731,11 @@
3729 @ <table border=0>
3730 if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
3731 @ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));">
3732 }else if( zColor[0] ){
3733 @ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));">
3734 }else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){
3735 @ <tr><td style="background-color:%h(hash_color(zDplyBr));">
3736 }else{
3737 @ <tr><td>
3738 }
3739 @ %!W(blob_str(&comment))
3740
--- src/info.c
+++ src/info.c
@@ -1141,13 +1141,14 @@
1141 }
1142 @ %s(zLinks)</td></tr>
1143 }
1144
1145 if( g.perm.Hyperlink ){
1146 char *zMainBranch = db_get("main-branch", 0);
1147 @ <tr><th>Other&nbsp;Links:</th>
1148 @ <td>
1149 if( fossil_strcmp(zBrName, zMainBranch)!=0 ){
1150 @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> |
1151 }
1152 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
1153 @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
1154 if( g.perm.Admin ){
@@ -3717,10 +3718,11 @@
3718 style_header("Edit Check-in [%s]", zUuid);
3719 if( P("preview") ){
3720 Blob suffix;
3721 int nTag = 0;
3722 const char *zDplyBr; /* Branch name used to determine BG color */
3723 char *zMainBranch = db_get("main-branch", 0);
3724 if( zNewBrFlag[0] && zNewBranch[0] ){
3725 zDplyBr = zNewBranch;
3726 }else{
3727 zDplyBr = zBranchName;
3728 }
@@ -3729,11 +3731,11 @@
3731 @ <table border=0>
3732 if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
3733 @ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));">
3734 }else if( zColor[0] ){
3735 @ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));">
3736 }else if( zDplyBr && fossil_strcmp(zDplyBr, zMainBranch)!=0 ){
3737 @ <tr><td style="background-color:%h(hash_color(zDplyBr));">
3738 }else{
3739 @ <tr><td>
3740 }
3741 @ %!W(blob_str(&comment))
3742
--- src/json_branch.c
+++ src/json_branch.c
@@ -313,10 +313,11 @@
313313
cson_value * payV = NULL;
314314
cson_object * pay = NULL;
315315
int rc = 0;
316316
BranchCreateOptions opt;
317317
char * zUuid = NULL;
318
+ char *zMainBranch = db_get("main-branch", 0);
318319
int rid = 0;
319320
if( !g.perm.Write ){
320321
json_set_err(FSL_JSON_E_DENIED,
321322
"Requires 'i' permissions.");
322323
return NULL;
@@ -340,11 +341,11 @@
340341
opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
341342
if(!opt.zBasis && !g.isHTTP){
342343
opt.zBasis = json_command_arg(g.json.dispatchDepth+2);
343344
}
344345
if(!opt.zBasis){
345
- opt.zBasis = "trunk";
346
+ opt.zBasis = fossil_strdup(zMainBranch);
346347
}
347348
opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1);
348349
if(-1==opt.isPrivate){
349350
if(!g.isHTTP){
350351
opt.isPrivate = (NULL != find_option("private","",0));
351352
--- src/json_branch.c
+++ src/json_branch.c
@@ -313,10 +313,11 @@
313 cson_value * payV = NULL;
314 cson_object * pay = NULL;
315 int rc = 0;
316 BranchCreateOptions opt;
317 char * zUuid = NULL;
 
318 int rid = 0;
319 if( !g.perm.Write ){
320 json_set_err(FSL_JSON_E_DENIED,
321 "Requires 'i' permissions.");
322 return NULL;
@@ -340,11 +341,11 @@
340 opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
341 if(!opt.zBasis && !g.isHTTP){
342 opt.zBasis = json_command_arg(g.json.dispatchDepth+2);
343 }
344 if(!opt.zBasis){
345 opt.zBasis = "trunk";
346 }
347 opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1);
348 if(-1==opt.isPrivate){
349 if(!g.isHTTP){
350 opt.isPrivate = (NULL != find_option("private","",0));
351
--- src/json_branch.c
+++ src/json_branch.c
@@ -313,10 +313,11 @@
313 cson_value * payV = NULL;
314 cson_object * pay = NULL;
315 int rc = 0;
316 BranchCreateOptions opt;
317 char * zUuid = NULL;
318 char *zMainBranch = db_get("main-branch", 0);
319 int rid = 0;
320 if( !g.perm.Write ){
321 json_set_err(FSL_JSON_E_DENIED,
322 "Requires 'i' permissions.");
323 return NULL;
@@ -340,11 +341,11 @@
341 opt.zBasis = json_find_option_cstr("basis",NULL,NULL);
342 if(!opt.zBasis && !g.isHTTP){
343 opt.zBasis = json_command_arg(g.json.dispatchDepth+2);
344 }
345 if(!opt.zBasis){
346 opt.zBasis = fossil_strdup(zMainBranch);
347 }
348 opt.isPrivate = json_find_option_bool("private",NULL,NULL,-1);
349 if(-1==opt.isPrivate){
350 if(!g.isHTTP){
351 opt.isPrivate = (NULL != find_option("private","",0));
352
+3 -1
--- src/leaf.c
+++ src/leaf.c
@@ -226,14 +226,16 @@
226226
int leaf_ambiguity_warning(int rid, int currentCkout){
227227
char *zBr;
228228
Stmt q;
229229
int n = 0;
230230
Blob msg;
231
+ const char *zMainBranch;
231232
if( leaf_ambiguity(rid)==0 ) return 0;
233
+ zMainBranch = db_get("main-branch", 0);
232234
zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
233235
TAG_BRANCH, rid);
234
- if( zBr==0 ) zBr = fossil_strdup("trunk");
236
+ if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
235237
blob_init(&msg, 0, 0);
236238
blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr);
237239
db_prepare(&q,
238240
"SELECT"
239241
" (SELECT uuid FROM blob WHERE rid=leaf.rid),"
240242
--- src/leaf.c
+++ src/leaf.c
@@ -226,14 +226,16 @@
226 int leaf_ambiguity_warning(int rid, int currentCkout){
227 char *zBr;
228 Stmt q;
229 int n = 0;
230 Blob msg;
 
231 if( leaf_ambiguity(rid)==0 ) return 0;
 
232 zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
233 TAG_BRANCH, rid);
234 if( zBr==0 ) zBr = fossil_strdup("trunk");
235 blob_init(&msg, 0, 0);
236 blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr);
237 db_prepare(&q,
238 "SELECT"
239 " (SELECT uuid FROM blob WHERE rid=leaf.rid),"
240
--- src/leaf.c
+++ src/leaf.c
@@ -226,14 +226,16 @@
226 int leaf_ambiguity_warning(int rid, int currentCkout){
227 char *zBr;
228 Stmt q;
229 int n = 0;
230 Blob msg;
231 const char *zMainBranch;
232 if( leaf_ambiguity(rid)==0 ) return 0;
233 zMainBranch = db_get("main-branch", 0);
234 zBr = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
235 TAG_BRANCH, rid);
236 if( zBr==0 ) zBr = fossil_strdup(zMainBranch);
237 blob_init(&msg, 0, 0);
238 blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr);
239 db_prepare(&q,
240 "SELECT"
241 " (SELECT uuid FROM blob WHERE rid=leaf.rid),"
242
+4 -3
--- src/rebuild.c
+++ src/rebuild.c
@@ -351,11 +351,12 @@
351351
/*
352352
** Check to see if the "sym-trunk" tag exists. If not, create it
353353
** and attach it to the very first check-in.
354354
*/
355355
static void rebuild_tag_trunk(void){
356
- int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
356
+ char *zMainBranch = db_get("main-branch", 0);
357
+ int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-%q'",zMainBranch);
357358
int rid;
358359
char *zUuid;
359360
360361
if( tagid>0 ) return;
361362
rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
@@ -363,12 +364,12 @@
363364
if( rid==0 ) return;
364365
365366
/* Add the trunk tag to the root of the whole tree */
366367
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
367368
if( zUuid==0 ) return;
368
- tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0);
369
- tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0);
369
+ tag_add_artifact("sym-", zMainBranch, zUuid, 0, 2, 0, 0);
370
+ tag_add_artifact("", "branch", zUuid, zMainBranch, 2, 0, 0);
370371
}
371372
372373
/*
373374
** Core function to rebuild the information in the derived tables of a
374375
** fossil repository from the blobs. This function is shared between
375376
--- src/rebuild.c
+++ src/rebuild.c
@@ -351,11 +351,12 @@
351 /*
352 ** Check to see if the "sym-trunk" tag exists. If not, create it
353 ** and attach it to the very first check-in.
354 */
355 static void rebuild_tag_trunk(void){
356 int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-trunk'");
 
357 int rid;
358 char *zUuid;
359
360 if( tagid>0 ) return;
361 rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
@@ -363,12 +364,12 @@
363 if( rid==0 ) return;
364
365 /* Add the trunk tag to the root of the whole tree */
366 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
367 if( zUuid==0 ) return;
368 tag_add_artifact("sym-", "trunk", zUuid, 0, 2, 0, 0);
369 tag_add_artifact("", "branch", zUuid, "trunk", 2, 0, 0);
370 }
371
372 /*
373 ** Core function to rebuild the information in the derived tables of a
374 ** fossil repository from the blobs. This function is shared between
375
--- src/rebuild.c
+++ src/rebuild.c
@@ -351,11 +351,12 @@
351 /*
352 ** Check to see if the "sym-trunk" tag exists. If not, create it
353 ** and attach it to the very first check-in.
354 */
355 static void rebuild_tag_trunk(void){
356 char *zMainBranch = db_get("main-branch", 0);
357 int tagid = db_int(0, "SELECT 1 FROM tag WHERE tagname='sym-%q'",zMainBranch);
358 int rid;
359 char *zUuid;
360
361 if( tagid>0 ) return;
362 rid = db_int(0, "SELECT pid FROM plink AS x WHERE NOT EXISTS("
@@ -363,12 +364,12 @@
364 if( rid==0 ) return;
365
366 /* Add the trunk tag to the root of the whole tree */
367 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
368 if( zUuid==0 ) return;
369 tag_add_artifact("sym-", zMainBranch, zUuid, 0, 2, 0, 0);
370 tag_add_artifact("", "branch", zUuid, zMainBranch, 2, 0, 0);
371 }
372
373 /*
374 ** Core function to rebuild the information in the derived tables of a
375 ** fossil repository from the blobs. This function is shared between
376
+4 -2
--- src/search.c
+++ src/search.c
@@ -852,11 +852,12 @@
852852
){
853853
search_init(zPattern, "<mark>", "</mark>", " ... ",
854854
SRCHFLG_STATIC|SRCHFLG_HTML);
855855
if( (srchFlags & SRCH_DOC)!=0 ){
856856
char *zDocGlob = db_get("doc-glob","");
857
- char *zDocBr = db_get("doc-branch","trunk");
857
+ char *zMainBranch = db_get("main-branch", 0);
858
+ char *zDocBr = db_get("doc-branch", zMainBranch);
858859
if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
859860
Glob * pGlob = glob_create(zDocBr)
860861
/* We're misusing a Glob as a list of comma-/space-delimited
861862
** tokens. We're not actually doing glob matches here. */;
862863
int i;
@@ -1986,11 +1987,12 @@
19861987
** and if the latest check-in on doc-br is in the unindexed set of
19871988
** check-ins, then update all 'd' entries in FTSDOCS that have
19881989
** changed.
19891990
*/
19901991
static void search_update_doc_index(void){
1991
- const char *zDocBranches = db_get("doc-branch","trunk");
1992
+ char *zMainBranch = db_get("main-branch", 0);
1993
+ const char *zDocBranches = db_get("doc-branch", zMainBranch);
19921994
int i;
19931995
Glob * pGlob = glob_create(zDocBranches)
19941996
/* We're misusing a Glob as a list of comma-/space-delimited
19951997
** tokens. We're not actually doing glob matches here. */;
19961998
if( !pGlob ) return;
19971999
--- src/search.c
+++ src/search.c
@@ -852,11 +852,12 @@
852 ){
853 search_init(zPattern, "<mark>", "</mark>", " ... ",
854 SRCHFLG_STATIC|SRCHFLG_HTML);
855 if( (srchFlags & SRCH_DOC)!=0 ){
856 char *zDocGlob = db_get("doc-glob","");
857 char *zDocBr = db_get("doc-branch","trunk");
 
858 if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
859 Glob * pGlob = glob_create(zDocBr)
860 /* We're misusing a Glob as a list of comma-/space-delimited
861 ** tokens. We're not actually doing glob matches here. */;
862 int i;
@@ -1986,11 +1987,12 @@
1986 ** and if the latest check-in on doc-br is in the unindexed set of
1987 ** check-ins, then update all 'd' entries in FTSDOCS that have
1988 ** changed.
1989 */
1990 static void search_update_doc_index(void){
1991 const char *zDocBranches = db_get("doc-branch","trunk");
 
1992 int i;
1993 Glob * pGlob = glob_create(zDocBranches)
1994 /* We're misusing a Glob as a list of comma-/space-delimited
1995 ** tokens. We're not actually doing glob matches here. */;
1996 if( !pGlob ) return;
1997
--- src/search.c
+++ src/search.c
@@ -852,11 +852,12 @@
852 ){
853 search_init(zPattern, "<mark>", "</mark>", " ... ",
854 SRCHFLG_STATIC|SRCHFLG_HTML);
855 if( (srchFlags & SRCH_DOC)!=0 ){
856 char *zDocGlob = db_get("doc-glob","");
857 char *zMainBranch = db_get("main-branch", 0);
858 char *zDocBr = db_get("doc-branch", zMainBranch);
859 if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
860 Glob * pGlob = glob_create(zDocBr)
861 /* We're misusing a Glob as a list of comma-/space-delimited
862 ** tokens. We're not actually doing glob matches here. */;
863 int i;
@@ -1986,11 +1987,12 @@
1987 ** and if the latest check-in on doc-br is in the unindexed set of
1988 ** check-ins, then update all 'd' entries in FTSDOCS that have
1989 ** changed.
1990 */
1991 static void search_update_doc_index(void){
1992 char *zMainBranch = db_get("main-branch", 0);
1993 const char *zDocBranches = db_get("doc-branch", zMainBranch);
1994 int i;
1995 Glob * pGlob = glob_create(zDocBranches)
1996 /* We're misusing a Glob as a list of comma-/space-delimited
1997 ** tokens. We're not actually doing glob matches here. */;
1998 if( !pGlob ) return;
1999
+5 -2
--- src/setup.c
+++ src/setup.c
@@ -2282,10 +2282,11 @@
22822282
** WEBPAGE: srchsetup
22832283
**
22842284
** Configure the search engine. Requires Admin privilege.
22852285
*/
22862286
void page_srchsetup(){
2287
+ char *zMainBranch;
22872288
login_check_credentials();
22882289
if( !g.perm.Admin ){
22892290
login_needed(0);
22902291
return;
22912292
}
@@ -2312,13 +2313,15 @@
23122313
@ <tr><td>*<td><td>Search all checked-in files</tr>
23132314
@ <tr><td><i>(blank)</i><td>
23142315
@ <td>Search nothing. (Disables document search).</tr>
23152316
@ </table>
23162317
@ <hr>
2317
- entry_attribute("Document Branches", 20, "doc-branch", "db", "trunk", 0);
2318
+ zMainBranch = db_get("main-branch", 0);
2319
+ entry_attribute("Document Branches", 20, "doc-branch", "db", zMainBranch, 0);
23182320
@ <p>When searching documents, use the versions of the files found at the
2319
- @ type of the "Document Branches" branch. Recommended value: "trunk".
2321
+ @ type of the "Document Branches" branch. Recommended value: the name of
2322
+ @ the main branch (usually "trunk").
23202323
@ Document search is disabled if blank. It may be a list of branch names
23212324
@ separated by spaces and/or commas.
23222325
@ <hr>
23232326
onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0);
23242327
@ <br>
23252328
--- src/setup.c
+++ src/setup.c
@@ -2282,10 +2282,11 @@
2282 ** WEBPAGE: srchsetup
2283 **
2284 ** Configure the search engine. Requires Admin privilege.
2285 */
2286 void page_srchsetup(){
 
2287 login_check_credentials();
2288 if( !g.perm.Admin ){
2289 login_needed(0);
2290 return;
2291 }
@@ -2312,13 +2313,15 @@
2312 @ <tr><td>*<td><td>Search all checked-in files</tr>
2313 @ <tr><td><i>(blank)</i><td>
2314 @ <td>Search nothing. (Disables document search).</tr>
2315 @ </table>
2316 @ <hr>
2317 entry_attribute("Document Branches", 20, "doc-branch", "db", "trunk", 0);
 
2318 @ <p>When searching documents, use the versions of the files found at the
2319 @ type of the "Document Branches" branch. Recommended value: "trunk".
 
2320 @ Document search is disabled if blank. It may be a list of branch names
2321 @ separated by spaces and/or commas.
2322 @ <hr>
2323 onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0);
2324 @ <br>
2325
--- src/setup.c
+++ src/setup.c
@@ -2282,10 +2282,11 @@
2282 ** WEBPAGE: srchsetup
2283 **
2284 ** Configure the search engine. Requires Admin privilege.
2285 */
2286 void page_srchsetup(){
2287 char *zMainBranch;
2288 login_check_credentials();
2289 if( !g.perm.Admin ){
2290 login_needed(0);
2291 return;
2292 }
@@ -2312,13 +2313,15 @@
2313 @ <tr><td>*<td><td>Search all checked-in files</tr>
2314 @ <tr><td><i>(blank)</i><td>
2315 @ <td>Search nothing. (Disables document search).</tr>
2316 @ </table>
2317 @ <hr>
2318 zMainBranch = db_get("main-branch", 0);
2319 entry_attribute("Document Branches", 20, "doc-branch", "db", zMainBranch, 0);
2320 @ <p>When searching documents, use the versions of the files found at the
2321 @ type of the "Document Branches" branch. Recommended value: the name of
2322 @ the main branch (usually "trunk").
2323 @ Document search is disabled if blank. It may be a list of branch names
2324 @ separated by spaces and/or commas.
2325 @ <hr>
2326 onoff_attribute("Search Check-in Comments", "search-ci", "sc", 0, 0);
2327 @ <br>
2328
+10 -5
--- src/tar.c
+++ src/tar.c
@@ -884,11 +884,12 @@
884884
** Generate a compressed tarball for the check-in specified by VERSION.
885885
** The tarball is called NAME.tar.gz and has a top-level directory called
886886
** NAME. If TAG is provided, then VERSION must hold TAG or else an error
887887
** is returned.
888888
**
889
-** The optional VERSION element defaults to "trunk" per the r= rules below.
889
+** The optional VERSION element defaults to the name of the main branch
890
+** (usually "trunk") per the r= rules below.
890891
** All of the following URLs are equivalent:
891892
**
892893
** /tarball/release/xyz.tar.gz
893894
** /tarball?r=release&name=xyz.tar.gz
894895
** /tarball/xyz.tar.gz?r=release
@@ -897,23 +898,26 @@
897898
** Query parameters:
898899
**
899900
** name=[CKIN/]NAME The optional CKIN component of the name= parameter
900901
** identifies the check-in from which the tarball is
901902
** constructed. If CKIN is omitted and there is no
902
-** r= query parameter, then use "trunk". NAME is the
903
+** r= query parameter, then use the name of the main
904
+** branch (usually "trunk"). NAME is the
903905
** name of the download file. The top-level directory
904906
** in the generated tarball is called by NAME with the
905907
** file extension removed.
906908
**
907909
** r=TAG TAG identifies the check-in that is turned into a
908
-** compressed tarball. The default value is "trunk".
910
+** compressed tarball. The default value is the name of
911
+** the main branch (usually "trunk").
909912
** If r= is omitted and if the name= query parameter
910913
** contains one "/" character then the of part the
911914
** name= value before the / becomes the TAG and the
912915
** part of the name= value after the / is the download
913916
** filename. If no check-in is specified by either
914
-** name= or r=, then "trunk" is used.
917
+** name= or r=, then the name of the main branch
918
+** (usually "trunk") is used.
915919
**
916920
** in=PATTERN Only include files that match the comma-separate
917921
** list of GLOB patterns in PATTERN, as with ex=
918922
**
919923
** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -945,20 +949,21 @@
945949
Blob cacheKey; /* The key to cache */
946950
Glob *pInclude = 0; /* The compiled in= glob pattern */
947951
Glob *pExclude = 0; /* The compiled ex= glob pattern */
948952
Blob tarball; /* Tarball accumulated here */
949953
const char *z;
954
+ char *zMainBranch = db_get("main-branch", 0);
950955
951956
login_check_credentials();
952957
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
953958
if( robot_restrict("zip") ) return;
954959
fossil_nice_default();
955960
zName = fossil_strdup(PD("name",""));
956961
z = P("r");
957962
if( z==0 ) z = P("uuid");
958963
if( z==0 ) z = tar_uuid_from_name(&zName);
959
- if( z==0 ) z = "trunk";
964
+ if( z==0 ) z = fossil_strdup(zMainBranch);
960965
g.zOpenRevision = zRid = fossil_strdup(z);
961966
nRid = strlen(zRid);
962967
zInclude = P("in");
963968
if( zInclude ) pInclude = glob_create(zInclude);
964969
zExclude = P("ex");
965970
--- src/tar.c
+++ src/tar.c
@@ -884,11 +884,12 @@
884 ** Generate a compressed tarball for the check-in specified by VERSION.
885 ** The tarball is called NAME.tar.gz and has a top-level directory called
886 ** NAME. If TAG is provided, then VERSION must hold TAG or else an error
887 ** is returned.
888 **
889 ** The optional VERSION element defaults to "trunk" per the r= rules below.
 
890 ** All of the following URLs are equivalent:
891 **
892 ** /tarball/release/xyz.tar.gz
893 ** /tarball?r=release&name=xyz.tar.gz
894 ** /tarball/xyz.tar.gz?r=release
@@ -897,23 +898,26 @@
897 ** Query parameters:
898 **
899 ** name=[CKIN/]NAME The optional CKIN component of the name= parameter
900 ** identifies the check-in from which the tarball is
901 ** constructed. If CKIN is omitted and there is no
902 ** r= query parameter, then use "trunk". NAME is the
 
903 ** name of the download file. The top-level directory
904 ** in the generated tarball is called by NAME with the
905 ** file extension removed.
906 **
907 ** r=TAG TAG identifies the check-in that is turned into a
908 ** compressed tarball. The default value is "trunk".
 
909 ** If r= is omitted and if the name= query parameter
910 ** contains one "/" character then the of part the
911 ** name= value before the / becomes the TAG and the
912 ** part of the name= value after the / is the download
913 ** filename. If no check-in is specified by either
914 ** name= or r=, then "trunk" is used.
 
915 **
916 ** in=PATTERN Only include files that match the comma-separate
917 ** list of GLOB patterns in PATTERN, as with ex=
918 **
919 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -945,20 +949,21 @@
945 Blob cacheKey; /* The key to cache */
946 Glob *pInclude = 0; /* The compiled in= glob pattern */
947 Glob *pExclude = 0; /* The compiled ex= glob pattern */
948 Blob tarball; /* Tarball accumulated here */
949 const char *z;
 
950
951 login_check_credentials();
952 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
953 if( robot_restrict("zip") ) return;
954 fossil_nice_default();
955 zName = fossil_strdup(PD("name",""));
956 z = P("r");
957 if( z==0 ) z = P("uuid");
958 if( z==0 ) z = tar_uuid_from_name(&zName);
959 if( z==0 ) z = "trunk";
960 g.zOpenRevision = zRid = fossil_strdup(z);
961 nRid = strlen(zRid);
962 zInclude = P("in");
963 if( zInclude ) pInclude = glob_create(zInclude);
964 zExclude = P("ex");
965
--- src/tar.c
+++ src/tar.c
@@ -884,11 +884,12 @@
884 ** Generate a compressed tarball for the check-in specified by VERSION.
885 ** The tarball is called NAME.tar.gz and has a top-level directory called
886 ** NAME. If TAG is provided, then VERSION must hold TAG or else an error
887 ** is returned.
888 **
889 ** The optional VERSION element defaults to the name of the main branch
890 ** (usually "trunk") per the r= rules below.
891 ** All of the following URLs are equivalent:
892 **
893 ** /tarball/release/xyz.tar.gz
894 ** /tarball?r=release&name=xyz.tar.gz
895 ** /tarball/xyz.tar.gz?r=release
@@ -897,23 +898,26 @@
898 ** Query parameters:
899 **
900 ** name=[CKIN/]NAME The optional CKIN component of the name= parameter
901 ** identifies the check-in from which the tarball is
902 ** constructed. If CKIN is omitted and there is no
903 ** r= query parameter, then use the name of the main
904 ** branch (usually "trunk"). NAME is the
905 ** name of the download file. The top-level directory
906 ** in the generated tarball is called by NAME with the
907 ** file extension removed.
908 **
909 ** r=TAG TAG identifies the check-in that is turned into a
910 ** compressed tarball. The default value is the name of
911 ** the main branch (usually "trunk").
912 ** If r= is omitted and if the name= query parameter
913 ** contains one "/" character then the of part the
914 ** name= value before the / becomes the TAG and the
915 ** part of the name= value after the / is the download
916 ** filename. If no check-in is specified by either
917 ** name= or r=, then the name of the main branch
918 ** (usually "trunk") is used.
919 **
920 ** in=PATTERN Only include files that match the comma-separate
921 ** list of GLOB patterns in PATTERN, as with ex=
922 **
923 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -945,20 +949,21 @@
949 Blob cacheKey; /* The key to cache */
950 Glob *pInclude = 0; /* The compiled in= glob pattern */
951 Glob *pExclude = 0; /* The compiled ex= glob pattern */
952 Blob tarball; /* Tarball accumulated here */
953 const char *z;
954 char *zMainBranch = db_get("main-branch", 0);
955
956 login_check_credentials();
957 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
958 if( robot_restrict("zip") ) return;
959 fossil_nice_default();
960 zName = fossil_strdup(PD("name",""));
961 z = P("r");
962 if( z==0 ) z = P("uuid");
963 if( z==0 ) z = tar_uuid_from_name(&zName);
964 if( z==0 ) z = fossil_strdup(zMainBranch);
965 g.zOpenRevision = zRid = fossil_strdup(z);
966 nRid = strlen(zRid);
967 zInclude = P("in");
968 if( zInclude ) pInclude = glob_create(zInclude);
969 zExclude = P("ex");
970
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -592,11 +592,11 @@
592592
zBr = branch_of_rid(rid);
593593
if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
594594
/* If no background color is specified, use a color based on the
595595
** branch name */
596596
if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
597
- }else if( zBr==0 || strcmp(zBr,zMainBranch)==0 ){
597
+ }else if( zBr==0 || strcmp(zBr, zMainBranch)==0 ){
598598
zBgClr = 0;
599599
}else{
600600
zBgClr = hash_color(zBr);
601601
}
602602
}
603603
--- src/timeline.c
+++ src/timeline.c
@@ -592,11 +592,11 @@
592 zBr = branch_of_rid(rid);
593 if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
594 /* If no background color is specified, use a color based on the
595 ** branch name */
596 if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
597 }else if( zBr==0 || strcmp(zBr,zMainBranch)==0 ){
598 zBgClr = 0;
599 }else{
600 zBgClr = hash_color(zBr);
601 }
602 }
603
--- src/timeline.c
+++ src/timeline.c
@@ -592,11 +592,11 @@
592 zBr = branch_of_rid(rid);
593 if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
594 /* If no background color is specified, use a color based on the
595 ** branch name */
596 if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
597 }else if( zBr==0 || strcmp(zBr, zMainBranch)==0 ){
598 zBgClr = 0;
599 }else{
600 zBgClr = hash_color(zBr);
601 }
602 }
603
+2 -1
--- src/update.c
+++ src/update.c
@@ -751,16 +751,17 @@
751751
Manifest *historical_manifest(
752752
const char *zRevision /* The check-in to query, or NULL for current */
753753
){
754754
int vid;
755755
Manifest *pManifest;
756
+ char *zMainBranch = db_get("main-branch", 0);
756757
757758
/* Determine the check-in manifest artifact ID. Panic on failure. */
758759
if( zRevision ){
759760
vid = name_to_typed_rid(zRevision, "ci");
760761
}else if( !g.localOpen ){
761
- vid = name_to_typed_rid(db_get("main-branch", 0), "ci");
762
+ vid = name_to_typed_rid(zMainBranch, "ci");
762763
}else{
763764
vid = db_lget_int("checkout", 0);
764765
if( !is_a_version(vid) ){
765766
if( vid==0 ) return 0;
766767
zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
767768
--- src/update.c
+++ src/update.c
@@ -751,16 +751,17 @@
751 Manifest *historical_manifest(
752 const char *zRevision /* The check-in to query, or NULL for current */
753 ){
754 int vid;
755 Manifest *pManifest;
 
756
757 /* Determine the check-in manifest artifact ID. Panic on failure. */
758 if( zRevision ){
759 vid = name_to_typed_rid(zRevision, "ci");
760 }else if( !g.localOpen ){
761 vid = name_to_typed_rid(db_get("main-branch", 0), "ci");
762 }else{
763 vid = db_lget_int("checkout", 0);
764 if( !is_a_version(vid) ){
765 if( vid==0 ) return 0;
766 zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
767
--- src/update.c
+++ src/update.c
@@ -751,16 +751,17 @@
751 Manifest *historical_manifest(
752 const char *zRevision /* The check-in to query, or NULL for current */
753 ){
754 int vid;
755 Manifest *pManifest;
756 char *zMainBranch = db_get("main-branch", 0);
757
758 /* Determine the check-in manifest artifact ID. Panic on failure. */
759 if( zRevision ){
760 vid = name_to_typed_rid(zRevision, "ci");
761 }else if( !g.localOpen ){
762 vid = name_to_typed_rid(zMainBranch, "ci");
763 }else{
764 vid = db_lget_int("checkout", 0);
765 if( !is_a_version(vid) ){
766 if( vid==0 ) return 0;
767 zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
768
+10 -5
--- src/zip.c
+++ src/zip.c
@@ -953,11 +953,12 @@
953953
**
954954
** Generate a ZIP Archive or an SQL Archive for the check-in specified by
955955
** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level
956956
** directory called NAME.
957957
**
958
-** The optional VERSION element defaults to "trunk" per the r= rules below.
958
+** The optional VERSION element defaults to the name of the main branch
959
+** (usually "trunk") per the r= rules below.
959960
** All of the following URLs are equivalent:
960961
**
961962
** /zip/release/xyz.zip
962963
** /zip?r=release&name=xyz.zip
963964
** /zip/xyz.zip?r=release
@@ -966,23 +967,26 @@
966967
** Query parameters:
967968
**
968969
** name=[CKIN/]NAME The optional CKIN component of the name= parameter
969970
** identifies the check-in from which the archive is
970971
** constructed. If CKIN is omitted and there is no
971
-** r= query parameter, then use "trunk". NAME is the
972
+** r= query parameter, then use the name of the main
973
+** branch (usually "trunk"). NAME is the
972974
** name of the download file. The top-level directory
973975
** in the generated archive is called by NAME with the
974976
** file extension removed.
975977
**
976978
** r=TAG TAG identifies the check-in that is turned into an
977
-** SQL or ZIP archive. The default value is "trunk".
979
+** SQL or ZIP archive. The default value is the name
980
+** of the main branch (usually "trunk").
978981
** If r= is omitted and if the name= query parameter
979982
** contains one "/" character then the of part the
980983
** name= value before the / becomes the TAG and the
981984
** part of the name= value after the / is the download
982985
** filename. If no check-in is specified by either
983
-** name= or r=, then "trunk" is used.
986
+** name= or r=, then the name of the main branch
987
+** (usually "trunk") is used.
984988
**
985989
** in=PATTERN Only include files that match the comma-separate
986990
** list of GLOB patterns in PATTERN, as with ex=
987991
**
988992
** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -1016,10 +1020,11 @@
10161020
Glob *pInclude = 0; /* The compiled in= glob pattern */
10171021
Glob *pExclude = 0; /* The compiled ex= glob pattern */
10181022
Blob zip; /* ZIP archive accumulated here */
10191023
int eType = ARCHIVE_ZIP; /* Type of archive to generate */
10201024
char *zType; /* Human-readable archive type */
1025
+ char *zMainBranch = db_get("main-branch", 0);
10211026
10221027
login_check_credentials();
10231028
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
10241029
if( robot_restrict("zip") ) return;
10251030
if( fossil_strcmp(g.zPath, "sqlar")==0 ){
@@ -1032,11 +1037,11 @@
10321037
fossil_nice_default();
10331038
zName = fossil_strdup(PD("name",""));
10341039
z = P("r");
10351040
if( z==0 ) z = P("uuid");
10361041
if( z==0 ) z = tar_uuid_from_name(&zName);
1037
- if( z==0 ) z = "trunk";
1042
+ if( z==0 ) z = fossil_strdup(zMainBranch);
10381043
nName = strlen(zName);
10391044
g.zOpenRevision = zRid = fossil_strdup(z);
10401045
nRid = strlen(zRid);
10411046
zInclude = P("in");
10421047
if( zInclude ) pInclude = glob_create(zInclude);
10431048
--- src/zip.c
+++ src/zip.c
@@ -953,11 +953,12 @@
953 **
954 ** Generate a ZIP Archive or an SQL Archive for the check-in specified by
955 ** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level
956 ** directory called NAME.
957 **
958 ** The optional VERSION element defaults to "trunk" per the r= rules below.
 
959 ** All of the following URLs are equivalent:
960 **
961 ** /zip/release/xyz.zip
962 ** /zip?r=release&name=xyz.zip
963 ** /zip/xyz.zip?r=release
@@ -966,23 +967,26 @@
966 ** Query parameters:
967 **
968 ** name=[CKIN/]NAME The optional CKIN component of the name= parameter
969 ** identifies the check-in from which the archive is
970 ** constructed. If CKIN is omitted and there is no
971 ** r= query parameter, then use "trunk". NAME is the
 
972 ** name of the download file. The top-level directory
973 ** in the generated archive is called by NAME with the
974 ** file extension removed.
975 **
976 ** r=TAG TAG identifies the check-in that is turned into an
977 ** SQL or ZIP archive. The default value is "trunk".
 
978 ** If r= is omitted and if the name= query parameter
979 ** contains one "/" character then the of part the
980 ** name= value before the / becomes the TAG and the
981 ** part of the name= value after the / is the download
982 ** filename. If no check-in is specified by either
983 ** name= or r=, then "trunk" is used.
 
984 **
985 ** in=PATTERN Only include files that match the comma-separate
986 ** list of GLOB patterns in PATTERN, as with ex=
987 **
988 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -1016,10 +1020,11 @@
1016 Glob *pInclude = 0; /* The compiled in= glob pattern */
1017 Glob *pExclude = 0; /* The compiled ex= glob pattern */
1018 Blob zip; /* ZIP archive accumulated here */
1019 int eType = ARCHIVE_ZIP; /* Type of archive to generate */
1020 char *zType; /* Human-readable archive type */
 
1021
1022 login_check_credentials();
1023 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
1024 if( robot_restrict("zip") ) return;
1025 if( fossil_strcmp(g.zPath, "sqlar")==0 ){
@@ -1032,11 +1037,11 @@
1032 fossil_nice_default();
1033 zName = fossil_strdup(PD("name",""));
1034 z = P("r");
1035 if( z==0 ) z = P("uuid");
1036 if( z==0 ) z = tar_uuid_from_name(&zName);
1037 if( z==0 ) z = "trunk";
1038 nName = strlen(zName);
1039 g.zOpenRevision = zRid = fossil_strdup(z);
1040 nRid = strlen(zRid);
1041 zInclude = P("in");
1042 if( zInclude ) pInclude = glob_create(zInclude);
1043
--- src/zip.c
+++ src/zip.c
@@ -953,11 +953,12 @@
953 **
954 ** Generate a ZIP Archive or an SQL Archive for the check-in specified by
955 ** VERSION. The archive is called NAME.zip or NAME.sqlar and has a top-level
956 ** directory called NAME.
957 **
958 ** The optional VERSION element defaults to the name of the main branch
959 ** (usually "trunk") per the r= rules below.
960 ** All of the following URLs are equivalent:
961 **
962 ** /zip/release/xyz.zip
963 ** /zip?r=release&name=xyz.zip
964 ** /zip/xyz.zip?r=release
@@ -966,23 +967,26 @@
967 ** Query parameters:
968 **
969 ** name=[CKIN/]NAME The optional CKIN component of the name= parameter
970 ** identifies the check-in from which the archive is
971 ** constructed. If CKIN is omitted and there is no
972 ** r= query parameter, then use the name of the main
973 ** branch (usually "trunk"). NAME is the
974 ** name of the download file. The top-level directory
975 ** in the generated archive is called by NAME with the
976 ** file extension removed.
977 **
978 ** r=TAG TAG identifies the check-in that is turned into an
979 ** SQL or ZIP archive. The default value is the name
980 ** of the main branch (usually "trunk").
981 ** If r= is omitted and if the name= query parameter
982 ** contains one "/" character then the of part the
983 ** name= value before the / becomes the TAG and the
984 ** part of the name= value after the / is the download
985 ** filename. If no check-in is specified by either
986 ** name= or r=, then the name of the main branch
987 ** (usually "trunk") is used.
988 **
989 ** in=PATTERN Only include files that match the comma-separate
990 ** list of GLOB patterns in PATTERN, as with ex=
991 **
992 ** ex=PATTERN Omit any file that match PATTERN. PATTERN is a
@@ -1016,10 +1020,11 @@
1020 Glob *pInclude = 0; /* The compiled in= glob pattern */
1021 Glob *pExclude = 0; /* The compiled ex= glob pattern */
1022 Blob zip; /* ZIP archive accumulated here */
1023 int eType = ARCHIVE_ZIP; /* Type of archive to generate */
1024 char *zType; /* Human-readable archive type */
1025 char *zMainBranch = db_get("main-branch", 0);
1026
1027 login_check_credentials();
1028 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
1029 if( robot_restrict("zip") ) return;
1030 if( fossil_strcmp(g.zPath, "sqlar")==0 ){
@@ -1032,11 +1037,11 @@
1037 fossil_nice_default();
1038 zName = fossil_strdup(PD("name",""));
1039 z = P("r");
1040 if( z==0 ) z = P("uuid");
1041 if( z==0 ) z = tar_uuid_from_name(&zName);
1042 if( z==0 ) z = fossil_strdup(zMainBranch);
1043 nName = strlen(zName);
1044 g.zOpenRevision = zRid = fossil_strdup(z);
1045 nRid = strlen(zRid);
1046 zInclude = P("in");
1047 if( zInclude ) pInclude = glob_create(zInclude);
1048

Keyboard Shortcuts

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