Fossil: Check-in [dccab378ce]

Fossil SCM

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modified grep command to respect the hash-digits config option.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | grep-hash-digits
Files: files | file ages | folders
SHA3-256:dccab378ce97437f4c52a61183134196d69286fa56febf23fb37eb5d531146f1
User & Date: stephan 2019-11-15 02:31:35
Context
2019-11-19
15:12
Merged in [grep-hash-digits] branch. See https://fossil-scm.org/forum/forumpost/44c8339561 check-in: 4de1ed780c user: stephan tags: trunk
2019-11-15
02:31
Modified grep command to respect the hash-digits config option. Closed-Leaf check-in: dccab378ce user: stephan tags: grep-hash-digits
2019-11-11
15:22
Omit some asm code from the SHA1 implementation as it provides no performance improvement with modern compilers, and SHA1 is seldom used now anyhow. check-in: 20187be723 user: drh tags: trunk
Changes

Changes to src/regexp.c.

735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
...
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
  for(i=j=ln=cnt=0; z[i]; i=j+1){
    for(j=i; z[j] && z[j]!='\n'; j++){}
    n = j - i;
    ln++;
    if( re_match(pRe, (const unsigned char*)(z+i), j-i) ){
      cnt++;
      if( flags & GREP_EXISTS ){
        fossil_print("%s\n", zName);
        break;
      }
      fossil_print("%s:%d:%.*s\n", zName, ln, n, z+i);
    }
  }
  return cnt;
}

/*
** COMMAND: test-grep
................................................................................
  if( file_tree_name(g.argv[3], &fullName, 0, 0) ){
    int fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q",
                      blob_str(&fullName));
    if( fnid ){
      Stmt q;
      add_content_sql_commands(g.db);
      db_prepare(&q,
        "SELECT content(ux), substr(ux,1,10) FROM ("
        "  SELECT blob.uuid AS ux, min(event.mtime) AS mx"
        "    FROM mlink, blob, event"
        "   WHERE mlink.mid=event.objid"
        "     AND mlink.fid=blob.rid"
        "     AND mlink.fnid=%d"
        "   GROUP BY blob.uuid"
        ") ORDER BY mx DESC;",
        fnid
      );
      while( db_step(&q)==SQLITE_ROW ){
        if( bVerbose ) fossil_print("%s:\n", db_column_text(&q,1));
        grep_buffer(pRe, db_column_text(&q,1), db_column_text(&q,0), flags);
      }
      db_finalize(&q);
    }
  }
}







|


|







 







|










|






735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
...
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
  for(i=j=ln=cnt=0; z[i]; i=j+1){
    for(j=i; z[j] && z[j]!='\n'; j++){}
    n = j - i;
    ln++;
    if( re_match(pRe, (const unsigned char*)(z+i), j-i) ){
      cnt++;
      if( flags & GREP_EXISTS ){
        fossil_print("%S\n", zName);
        break;
      }
      fossil_print("%S:%d:%.*s\n", zName, ln, n, z+i);
    }
  }
  return cnt;
}

/*
** COMMAND: test-grep
................................................................................
  if( file_tree_name(g.argv[3], &fullName, 0, 0) ){
    int fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q",
                      blob_str(&fullName));
    if( fnid ){
      Stmt q;
      add_content_sql_commands(g.db);
      db_prepare(&q,
        "SELECT content(ux), ux FROM ("
        "  SELECT blob.uuid AS ux, min(event.mtime) AS mx"
        "    FROM mlink, blob, event"
        "   WHERE mlink.mid=event.objid"
        "     AND mlink.fid=blob.rid"
        "     AND mlink.fnid=%d"
        "   GROUP BY blob.uuid"
        ") ORDER BY mx DESC;",
        fnid
      );
      while( db_step(&q)==SQLITE_ROW ){
        if( bVerbose ) fossil_print("%S:\n", db_column_text(&q,1));
        grep_buffer(pRe, db_column_text(&q,1), db_column_text(&q,0), flags);
      }
      db_finalize(&q);
    }
  }
}