Fossil SCM
For the timeline command, fix special case where -n|-limit is 0 when using after keyword.
Commit
6e3dde3afd437422917049629610913fea1c5acbcc64f13e9ac23bffa37e7d75
Parent
ea40cbb0c0520d7…
1 file changed
+7
-1
+7
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -3816,13 +3816,19 @@ | ||
| 3816 | 3816 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3817 | 3817 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3818 | 3818 | } |
| 3819 | 3819 | |
| 3820 | 3820 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3821 | + int lim = n; | |
| 3822 | + if( n == 0 ){ | |
| 3823 | + lim = -1; // 0 means no limit | |
| 3824 | + }else if( n < 0 ){ | |
| 3825 | + lim = -n; | |
| 3826 | + } | |
| 3821 | 3827 | /* Complete the above outer select. */ |
| 3822 | 3828 | blob_append_sql(&sql, |
| 3823 | - "\nORDER BY event.mtime LIMIT abs(%d)) t ORDER BY t.mDateTime DESC;", n); | |
| 3829 | + "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", lim); | |
| 3824 | 3830 | }else{ |
| 3825 | 3831 | blob_append_sql(&sql, "\nORDER BY event.mtime DESC"); |
| 3826 | 3832 | } |
| 3827 | 3833 | if( iOffset>0 ){ |
| 3828 | 3834 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3829 | 3835 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -3816,13 +3816,19 @@ | |
| 3816 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3817 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3818 | } |
| 3819 | |
| 3820 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3821 | /* Complete the above outer select. */ |
| 3822 | blob_append_sql(&sql, |
| 3823 | "\nORDER BY event.mtime LIMIT abs(%d)) t ORDER BY t.mDateTime DESC;", n); |
| 3824 | }else{ |
| 3825 | blob_append_sql(&sql, "\nORDER BY event.mtime DESC"); |
| 3826 | } |
| 3827 | if( iOffset>0 ){ |
| 3828 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3829 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -3816,13 +3816,19 @@ | |
| 3816 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3817 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3818 | } |
| 3819 | |
| 3820 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3821 | int lim = n; |
| 3822 | if( n == 0 ){ |
| 3823 | lim = -1; // 0 means no limit |
| 3824 | }else if( n < 0 ){ |
| 3825 | lim = -n; |
| 3826 | } |
| 3827 | /* Complete the above outer select. */ |
| 3828 | blob_append_sql(&sql, |
| 3829 | "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", lim); |
| 3830 | }else{ |
| 3831 | blob_append_sql(&sql, "\nORDER BY event.mtime DESC"); |
| 3832 | } |
| 3833 | if( iOffset>0 ){ |
| 3834 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3835 |