Fossil

Artifact [1f591c1d]
Login

Artifact [1f591c1d]

Artifact 1f591c1d8c59b922db85d32f24358cdee8e065bd:

Attachment "bugfix.patch" to ticket [3e58b8ce] added by anonymous 2010-11-26 04:29:43.
Index: src/timeline.c
===================================================================
--- src/timeline.c
+++ src/timeline.c
@@ -959,11 +959,11 @@
 
 /*
 ** The input query q selects various records.  Print a human-readable
 ** summary of those records.
 **
-** Limit the number of entries printed to nLine.
+** Limit the number of entries printed to mxEntries.
 ** 
 ** The query should return these columns:
 **
 **    0.  rid
 **    1.  uuid
@@ -970,22 +970,23 @@
 **    2.  Date/Time
 **    3.  Comment string and user
 **    4.  Number of non-merge children
 **    5.  Number of parents
 */
-void print_timeline(Stmt *q, int mxLine){
+void print_timeline(Stmt *q, int mxEntries){
   int nLine = 0;
+  int nEntries = 0;
   char zPrevDate[20];
   const char *zCurrentUuid=0;
   zPrevDate[0] = 0;
 
   if( g.localOpen ){
     int rid = db_lget_int("checkout", 0);
     zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
   }
 
-  while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){
+  while( db_step(q)==SQLITE_ROW && nEntries<mxEntries ){
     int rid = db_column_int(q, 0);
     const char *zId = db_column_text(q, 1);
     const char *zDate = db_column_text(q, 2);
     const char *zCom = db_column_text(q, 3);
     int nChild = db_column_int(q, 4);
@@ -1022,10 +1023,12 @@
       sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");
       n += strlen(zPrefix);
     }
     zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom);
     nLine += comment_print(zFree, 9, 79);
+
+    nEntries++;
     sqlite3_free(zFree);
   }
 }
 
 /*