Fossil SCM

Get the "fossil cat" command working outside of a check-out using the -R option. This is an alternative implementation to the fix-cat-dash-R branch that avoids adding a new global variable.

drh 2014-04-01 18:43 trunk
Commit ebe97b79f21a02423d8ded5958143dfb269f0ed1
2 files changed +5 -1 +2
+5 -1
--- src/file.c
+++ src/file.c
@@ -1044,11 +1044,14 @@
10441044
int nFull;
10451045
char *zFull;
10461046
int (*xCmp)(const char*,const char*,int);
10471047
10481048
blob_zero(pOut);
1049
- db_must_be_within_tree();
1049
+ if( !g.localOpen ){
1050
+ blob_appendf(pOut, "%s", zOrigName);
1051
+ return 1;
1052
+ }
10501053
file_canonical_name(g.zLocalRoot, &localRoot, 1);
10511054
nLocalRoot = blob_size(&localRoot);
10521055
zLocalRoot = blob_buffer(&localRoot);
10531056
assert( nLocalRoot>0 && zLocalRoot[nLocalRoot-1]=='/' );
10541057
file_canonical_name(zOrigName, &full, 0);
@@ -1093,10 +1096,11 @@
10931096
** a boolean: "yes", "no", "true", "false", etc.
10941097
*/
10951098
void cmd_test_tree_name(void){
10961099
int i;
10971100
Blob x;
1101
+ db_find_and_open_repository(0,0);
10981102
blob_zero(&x);
10991103
capture_case_sensitive_option();
11001104
for(i=2; i<g.argc; i++){
11011105
if( file_tree_name(g.argv[i], &x, 1) ){
11021106
fossil_print("%s\n", blob_buffer(&x));
11031107
--- src/file.c
+++ src/file.c
@@ -1044,11 +1044,14 @@
1044 int nFull;
1045 char *zFull;
1046 int (*xCmp)(const char*,const char*,int);
1047
1048 blob_zero(pOut);
1049 db_must_be_within_tree();
 
 
 
1050 file_canonical_name(g.zLocalRoot, &localRoot, 1);
1051 nLocalRoot = blob_size(&localRoot);
1052 zLocalRoot = blob_buffer(&localRoot);
1053 assert( nLocalRoot>0 && zLocalRoot[nLocalRoot-1]=='/' );
1054 file_canonical_name(zOrigName, &full, 0);
@@ -1093,10 +1096,11 @@
1093 ** a boolean: "yes", "no", "true", "false", etc.
1094 */
1095 void cmd_test_tree_name(void){
1096 int i;
1097 Blob x;
 
1098 blob_zero(&x);
1099 capture_case_sensitive_option();
1100 for(i=2; i<g.argc; i++){
1101 if( file_tree_name(g.argv[i], &x, 1) ){
1102 fossil_print("%s\n", blob_buffer(&x));
1103
--- src/file.c
+++ src/file.c
@@ -1044,11 +1044,14 @@
1044 int nFull;
1045 char *zFull;
1046 int (*xCmp)(const char*,const char*,int);
1047
1048 blob_zero(pOut);
1049 if( !g.localOpen ){
1050 blob_appendf(pOut, "%s", zOrigName);
1051 return 1;
1052 }
1053 file_canonical_name(g.zLocalRoot, &localRoot, 1);
1054 nLocalRoot = blob_size(&localRoot);
1055 zLocalRoot = blob_buffer(&localRoot);
1056 assert( nLocalRoot>0 && zLocalRoot[nLocalRoot-1]=='/' );
1057 file_canonical_name(zOrigName, &full, 0);
@@ -1093,10 +1096,11 @@
1096 ** a boolean: "yes", "no", "true", "false", etc.
1097 */
1098 void cmd_test_tree_name(void){
1099 int i;
1100 Blob x;
1101 db_find_and_open_repository(0,0);
1102 blob_zero(&x);
1103 capture_case_sensitive_option();
1104 for(i=2; i<g.argc; i++){
1105 if( file_tree_name(g.argv[i], &x, 1) ){
1106 fossil_print("%s\n", blob_buffer(&x));
1107
--- src/update.c
+++ src/update.c
@@ -625,10 +625,12 @@
625625
ManifestFile *pFile;
626626
int rid=0;
627627
628628
if( revision ){
629629
rid = name_to_typed_rid(revision,"ci");
630
+ }else if( !g.localOpen ){
631
+ rid = name_to_typed_rid(db_get("main-branch","trunk"),"ci");
630632
}else{
631633
rid = db_lget_int("checkout", 0);
632634
}
633635
if( !is_a_version(rid) ){
634636
if( errCode>0 ) return errCode;
635637
--- src/update.c
+++ src/update.c
@@ -625,10 +625,12 @@
625 ManifestFile *pFile;
626 int rid=0;
627
628 if( revision ){
629 rid = name_to_typed_rid(revision,"ci");
 
 
630 }else{
631 rid = db_lget_int("checkout", 0);
632 }
633 if( !is_a_version(rid) ){
634 if( errCode>0 ) return errCode;
635
--- src/update.c
+++ src/update.c
@@ -625,10 +625,12 @@
625 ManifestFile *pFile;
626 int rid=0;
627
628 if( revision ){
629 rid = name_to_typed_rid(revision,"ci");
630 }else if( !g.localOpen ){
631 rid = name_to_typed_rid(db_get("main-branch","trunk"),"ci");
632 }else{
633 rid = db_lget_int("checkout", 0);
634 }
635 if( !is_a_version(rid) ){
636 if( errCode>0 ) return errCode;
637

Keyboard Shortcuts

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