Fossil SCM

For 'fossil diff', allow --context to be 0, per request in [forum:806f1296d8 | forum post 806f1296d8].

danield 2024-02-04 21:28 trunk
Commit ea6f9a84aca1d1b0e7f4f0cb2788bde9e6daa7bcc30ae219126e4787db976ab8
1 file changed +7 -3
+7 -3
--- src/diff.c
+++ src/diff.c
@@ -3157,13 +3157,17 @@
31573157
/* Undocumented and unsupported flags used for development
31583158
** debugging and analysis: */
31593159
if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
31603160
if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
31613161
}
3162
- if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
3163
- pCfg->nContext = f;
3164
- diffFlags |= DIFF_CONTEXT_EX;
3162
+ if( (z = find_option("context","c",1))!=0 ){
3163
+ char *zEnd;
3164
+ f = (int)strtol(z, &zEnd, 10);
3165
+ if( zEnd[0]==0 && errno!=ERANGE ){
3166
+ pCfg->nContext = f;
3167
+ diffFlags |= DIFF_CONTEXT_EX;
3168
+ }
31653169
}
31663170
if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
31673171
pCfg->wColumn = f;
31683172
}
31693173
if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
31703174
--- src/diff.c
+++ src/diff.c
@@ -3157,13 +3157,17 @@
3157 /* Undocumented and unsupported flags used for development
3158 ** debugging and analysis: */
3159 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3160 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3161 }
3162 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
3163 pCfg->nContext = f;
3164 diffFlags |= DIFF_CONTEXT_EX;
 
 
 
 
3165 }
3166 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3167 pCfg->wColumn = f;
3168 }
3169 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
3170
--- src/diff.c
+++ src/diff.c
@@ -3157,13 +3157,17 @@
3157 /* Undocumented and unsupported flags used for development
3158 ** debugging and analysis: */
3159 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3160 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3161 }
3162 if( (z = find_option("context","c",1))!=0 ){
3163 char *zEnd;
3164 f = (int)strtol(z, &zEnd, 10);
3165 if( zEnd[0]==0 && errno!=ERANGE ){
3166 pCfg->nContext = f;
3167 diffFlags |= DIFF_CONTEXT_EX;
3168 }
3169 }
3170 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3171 pCfg->wColumn = f;
3172 }
3173 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
3174

Keyboard Shortcuts

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