Fossil SCM
All the --context option on diff to have a value of 0.
Commit
d74698ec28794dc10de018547d2bfa9ab51e3216
Parent
62cd2e24967d196…
1 file changed
+5
-4
+5
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -38,10 +38,11 @@ | ||
| 38 | 38 | #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ |
| 39 | 39 | #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ |
| 40 | 40 | #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ |
| 41 | 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | +#define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ | |
| 43 | 44 | |
| 44 | 45 | /* |
| 45 | 46 | ** These error messages are shared in multiple locations. They are defined |
| 46 | 47 | ** here for consistency. |
| 47 | 48 | */ |
| @@ -1800,11 +1801,11 @@ | ||
| 1800 | 1801 | ** Extract the number of lines of context from diffFlags. Supply an |
| 1801 | 1802 | ** appropriate default if no context width is specified. |
| 1802 | 1803 | */ |
| 1803 | 1804 | int diff_context_lines(u64 diffFlags){ |
| 1804 | 1805 | int n = diffFlags & DIFF_CONTEXT_MASK; |
| 1805 | - if( n==0 ) n = 5; | |
| 1806 | + if( n==0 && (diffFlags & DIFF_CONTEXT_EX)==0 ) n = 5; | |
| 1806 | 1807 | return n; |
| 1807 | 1808 | } |
| 1808 | 1809 | |
| 1809 | 1810 | /* |
| 1810 | 1811 | ** Extract the width of columns for side-by-side diff. Supply an |
| @@ -1903,19 +1904,19 @@ | ||
| 1903 | 1904 | ** --noopt Disable optimization DIFF_NOOPT |
| 1904 | 1905 | ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE |
| 1905 | 1906 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1906 | 1907 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1907 | 1908 | */ |
| 1908 | -int diff_options(void){ | |
| 1909 | +u64 diff_options(void){ | |
| 1909 | 1910 | u64 diffFlags = 0; |
| 1910 | 1911 | const char *z; |
| 1911 | 1912 | int f; |
| 1912 | 1913 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1913 | 1914 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1914 | - if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){ | |
| 1915 | + if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){ | |
| 1915 | 1916 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1916 | - diffFlags |= f; | |
| 1917 | + diffFlags |= f + DIFF_CONTEXT_EX; | |
| 1917 | 1918 | } |
| 1918 | 1919 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 1919 | 1920 | f *= DIFF_CONTEXT_MASK+1; |
| 1920 | 1921 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1921 | 1922 | diffFlags |= f; |
| 1922 | 1923 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ |
| 40 | #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | |
| 44 | /* |
| 45 | ** These error messages are shared in multiple locations. They are defined |
| 46 | ** here for consistency. |
| 47 | */ |
| @@ -1800,11 +1801,11 @@ | |
| 1800 | ** Extract the number of lines of context from diffFlags. Supply an |
| 1801 | ** appropriate default if no context width is specified. |
| 1802 | */ |
| 1803 | int diff_context_lines(u64 diffFlags){ |
| 1804 | int n = diffFlags & DIFF_CONTEXT_MASK; |
| 1805 | if( n==0 ) n = 5; |
| 1806 | return n; |
| 1807 | } |
| 1808 | |
| 1809 | /* |
| 1810 | ** Extract the width of columns for side-by-side diff. Supply an |
| @@ -1903,19 +1904,19 @@ | |
| 1903 | ** --noopt Disable optimization DIFF_NOOPT |
| 1904 | ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE |
| 1905 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1906 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1907 | */ |
| 1908 | int diff_options(void){ |
| 1909 | u64 diffFlags = 0; |
| 1910 | const char *z; |
| 1911 | int f; |
| 1912 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1913 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1914 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){ |
| 1915 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1916 | diffFlags |= f; |
| 1917 | } |
| 1918 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 1919 | f *= DIFF_CONTEXT_MASK+1; |
| 1920 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1921 | diffFlags |= f; |
| 1922 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ |
| 40 | #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | |
| 45 | /* |
| 46 | ** These error messages are shared in multiple locations. They are defined |
| 47 | ** here for consistency. |
| 48 | */ |
| @@ -1800,11 +1801,11 @@ | |
| 1801 | ** Extract the number of lines of context from diffFlags. Supply an |
| 1802 | ** appropriate default if no context width is specified. |
| 1803 | */ |
| 1804 | int diff_context_lines(u64 diffFlags){ |
| 1805 | int n = diffFlags & DIFF_CONTEXT_MASK; |
| 1806 | if( n==0 && (diffFlags & DIFF_CONTEXT_EX)==0 ) n = 5; |
| 1807 | return n; |
| 1808 | } |
| 1809 | |
| 1810 | /* |
| 1811 | ** Extract the width of columns for side-by-side diff. Supply an |
| @@ -1903,19 +1904,19 @@ | |
| 1904 | ** --noopt Disable optimization DIFF_NOOPT |
| 1905 | ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE |
| 1906 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1907 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1908 | */ |
| 1909 | u64 diff_options(void){ |
| 1910 | u64 diffFlags = 0; |
| 1911 | const char *z; |
| 1912 | int f; |
| 1913 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1914 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1915 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){ |
| 1916 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1917 | diffFlags |= f + DIFF_CONTEXT_EX; |
| 1918 | } |
| 1919 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 1920 | f *= DIFF_CONTEXT_MASK+1; |
| 1921 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1922 | diffFlags |= f; |
| 1923 |