Hello community,
here is the log from the commit of package the_silver_searcher for openSUSE:Factory checked in at 2017-01-22 00:21:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/the_silver_searcher (Old)
and /work/SRC/openSUSE:Factory/.the_silver_searcher.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "the_silver_searcher"
Changes:
--------
--- /work/SRC/openSUSE:Factory/the_silver_searcher/the_silver_searcher.changes 2016-09-30 15:35:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.the_silver_searcher.new/the_silver_searcher.changes 2017-01-22 00:21:58.208032218 +0100
@@ -1,0 +2,16 @@
+Mon Dec 5 08:26:41 UTC 2016 - astieger@suse.com
+
+- update to 1.0.2:
+ * updated for platforms other than Linux
+
+-------------------------------------------------------------------
+Mon Nov 28 09:20:39 UTC 2016 - astieger@suse.com
+
+- update to 1.0.1:
+ * faster substring search
+ * fix context line printing when reading from a pipe
+ * ignore local-domain socket just like named pipes
+ * updates of common file extensions
+ * add zsh completion function
+
+-------------------------------------------------------------------
Old:
----
the_silver_searcher-0.33.0.tar.gz
the_silver_searcher-0.33.0.tar.gz.asc
New:
----
the_silver_searcher-1.0.2.tar.gz
the_silver_searcher-1.0.2.tar.gz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ the_silver_searcher.spec ++++++
--- /var/tmp/diff_new_pack.Q0DSc5/_old 2017-01-22 00:21:59.471853336 +0100
+++ /var/tmp/diff_new_pack.Q0DSc5/_new 2017-01-22 00:21:59.471853336 +0100
@@ -17,7 +17,7 @@
Name: the_silver_searcher
-Version: 0.33.0
+Version: 1.0.2
Release: 0
Summary: A code-searching tool similar to ack, but faster
License: Apache-2.0
@@ -61,5 +61,8 @@
%{_bindir}/ag
%{_mandir}/man1/ag.1%{ext_man}
%config %{_sysconfdir}/bash_completion.d/%{name}
+%dir %{_datadir}/zsh
+%dir %{_datadir}/zsh/site-functions
+%{_datadir}/zsh/site-functions/_the_silver_searcher
%changelog
++++++ the_silver_searcher-0.33.0.tar.gz -> the_silver_searcher-1.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/Makefile.am new/the_silver_searcher-1.0.2/Makefile.am
--- old/the_silver_searcher-0.33.0/Makefile.am 2016-05-10 19:39:38.000000000 +0200
+++ new/the_silver_searcher-1.0.2/Makefile.am 2016-12-03 21:46:47.000000000 +0100
@@ -8,6 +8,8 @@
bashcompdir = $(pkgdatadir)/completions
dist_bashcomp_DATA = ag.bashcomp.sh
+zshcompdir = $(datadir)/zsh/site-functions
+dist_zshcomp_DATA = _the_silver_searcher
EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/Makefile.in new/the_silver_searcher-1.0.2/Makefile.in
--- old/the_silver_searcher-0.33.0/Makefile.in 2016-09-25 02:22:41.000000000 +0200
+++ new/the_silver_searcher-1.0.2/Makefile.in 2016-12-03 23:42:23.000000000 +0100
@@ -97,7 +97,8 @@
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
- $(am__configure_deps) $(dist_bashcomp_DATA) $(am__DIST_COMMON)
+ $(am__configure_deps) $(dist_bashcomp_DATA) \
+ $(dist_zshcomp_DATA) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
@@ -105,7 +106,7 @@
CONFIG_CLEAN_FILES = the_silver_searcher.spec
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
- "$(DESTDIR)$(bashcompdir)"
+ "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(zshcompdir)"
PROGRAMS = $(bin_PROGRAMS)
am__dirstamp = $(am__leading_dot)dirstamp
am_ag_OBJECTS = src/ignore.$(OBJEXT) src/log.$(OBJEXT) \
@@ -182,7 +183,7 @@
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(dist_man_MANS)
-DATA = $(dist_bashcomp_DATA)
+DATA = $(dist_bashcomp_DATA) $(dist_zshcomp_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@@ -338,6 +339,8 @@
dist_man_MANS = doc/ag.1
bashcompdir = $(pkgdatadir)/completions
dist_bashcomp_DATA = ag.bashcomp.sh
+zshcompdir = $(datadir)/zsh/site-functions
+dist_zshcomp_DATA = _the_silver_searcher
EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md
all: all-am
@@ -561,6 +564,27 @@
@list='$(dist_bashcomp_DATA)'; test -n "$(bashcompdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(bashcompdir)'; $(am__uninstall_files_from_dir)
+install-dist_zshcompDATA: $(dist_zshcomp_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_zshcomp_DATA)'; test -n "$(zshcompdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(zshcompdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(zshcompdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(zshcompdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(zshcompdir)" || exit $$?; \
+ done
+
+uninstall-dist_zshcompDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_zshcomp_DATA)'; test -n "$(zshcompdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(zshcompdir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -788,7 +812,7 @@
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(bashcompdir)"; do \
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(zshcompdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -846,7 +870,8 @@
info-am:
-install-data-am: install-dist_bashcompDATA install-man
+install-data-am: install-dist_bashcompDATA install-dist_zshcompDATA \
+ install-man
install-dvi: install-dvi-am
@@ -894,7 +919,7 @@
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-dist_bashcompDATA \
- uninstall-man
+ uninstall-dist_zshcompDATA uninstall-man
uninstall-man: uninstall-man1
@@ -908,15 +933,16 @@
distclean-hdr distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
- install-data-am install-dist_bashcompDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-man1 install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
- ps ps-am tags tags-am uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-dist_bashcompDATA \
+ install-data-am install-dist_bashcompDATA \
+ install-dist_zshcompDATA install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-man1 \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-dist_bashcompDATA uninstall-dist_zshcompDATA \
uninstall-man uninstall-man1
.PRECIOUS: Makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/README.md new/the_silver_searcher-1.0.2/README.md
--- old/the_silver_searcher-0.33.0/README.md 2016-09-24 03:33:26.000000000 +0200
+++ new/the_silver_searcher-1.0.2/README.md 2016-12-03 22:34:14.000000000 +0100
@@ -8,7 +8,7 @@
[![#ag on Freenode](http://img.shields.io/Freenode/%23ag.png)](https://webchat.freenode.net/?channels=ag)
-Do you know C? I invite you to pair with me to [help me get to Ag 1.0](http://geoff.greer.fm/2014/10/13/help-me-get-to-ag-10/).
+Do you know C? Want to improve ag? [I invite you to pair with me](http://geoff.greer.fm/2014/10/13/help-me-get-to-ag-10/).
## What's so great about Ag?
@@ -24,7 +24,7 @@
ag test_blah ~/code/ 4.67s user 4.58s system 286% cpu 3.227 total
-Ack and Ag found the same results, but Ag was 34x faster (3.2 seconds vs 110 seconds). My `~/code` directory is about 8GB. Thanks to git/hg/svn-ignore, Ag only searched 700MB of that.
+Ack and Ag found the same results, but Ag was 34x faster (3.2 seconds vs 110 seconds). My `~/code` directory is about 8GB. Thanks to git/hg/ignore, Ag only searched 700MB of that.
There are also [graphs of performance across releases](http://geoff.greer.fm/ag/speed/).
@@ -42,7 +42,7 @@
## Installing
-### OS X
+### MacOS
brew install the_silver_searcher
@@ -95,7 +95,7 @@
### Building master
1. Install dependencies (Automake, pkg-config, PCRE, LZMA):
- * OS X:
+ * MacOS:
brew install automake pkg-config pcre xz
or
@@ -151,10 +151,6 @@
Which has the same effect but will report every match on the line.
-There's also a fork of ack.vim tailored for use with Ag: [ag.vim][]
-[ack.vim]: https://github.com/mileszs/ack.vim
-[ag.vim]: https://github.com/rking/ag.vim
-
### Emacs
You can use [ag.el][] as an Emacs front-end to Ag. See also: [helm-ag].
@@ -169,9 +165,8 @@
## Other stuff you might like
* [Ack](https://github.com/petdance/ack2) - Better than grep. Without Ack, Ag would not exist.
-* [AckMate](https://github.com/protocool/AckMate) - An ack-powered replacement for TextMate's slow built-in search.
* [ack.vim](https://github.com/mileszs/ack.vim)
-* [ag.vim]( https://github.com/rking/ag.vim)
* [Exuberant Ctags](http://ctags.sourceforge.net/) - Faster than Ag, but it builds an index beforehand. Good for *really* big codebases.
* [Git-grep](http://git-scm.com/docs/git-grep) - As fast as Ag but only works on git repos.
+* [ripgrep](https://github.com/BurntSushi/ripgrep)
* [Sack](https://github.com/sampson-chen/sack) - A utility that wraps Ack and Ag. It removes a lot of repetition from searching and opening matching files.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/_the_silver_searcher new/the_silver_searcher-1.0.2/_the_silver_searcher
--- old/the_silver_searcher-0.33.0/_the_silver_searcher 1970-01-01 01:00:00.000000000 +0100
+++ new/the_silver_searcher-1.0.2/_the_silver_searcher 2016-11-28 06:07:11.000000000 +0100
@@ -0,0 +1,86 @@
+#compdef ag
+
+# Completion function for zsh
+
+local ret=1
+local -a args expl
+
+# Intentionally avoided many possible mutual exlusions because it is
+# likely that earlier options come from an alias. In line with this
+# the following conditionally adds options that assert defaults.
+[[ -n $words[(r)(-[is]|--ignore-case|--case-sensitive)] ]] && args+=(
+ '(-S --smart-case -s -s --ignore-case --case-sensitive)'{-S,--smart-case}'[insensitive match unless pattern includes uppercase]'
+)
+[[ -n $words[(r)--nobreak] ]] && args+=(
+ "(--nobreak)--break[print newlines between matches in different files]"
+)
+[[ -n $words[(r)--nogroup] ]] && args+=(
+ "(--nogroup)--group[don't repeat filename for each match line]"
+)
+
+_tags normal-options file-types
+while _tags; do
+ _requested normal-options && _arguments -S -s $args \
+ '--ackmate[print results in AckMate-parseable format]' \
+ '(--after -A)'{--after=-,-A+}'[specify lines of trailing context]::lines [2]' \
+ '(--before -B)'{--before=-,-B+}'[specify lines of leading context]::lines [2]' \
+ "--nobreak[don't print newlines between matches in different files]" \
+ '(--count -c)'{--count,-c}'[only print a count of matching lines]' \
+ '--color[enable color highlighting of output]' \
+ '(--color-line-number --color-match --color-path)--nocolor[disable color highlighting of output]' \
+ '--color-line-number=[specify color for line numbers]:color [1;33]' \
+ '--color-match=[specify color for result match numbers]:color [30;43]' \
+ '--color-path=[specify color for path names]:color [1;32]' \
+ '--column[print column numbers in results]' \
+ '(--context -C)'{--context=-,-C+}'[specify lines of context]::lines' \
+ '(--debug -D)'{--debug,-D}'[output debug information]' \
+ '--depth=[specify directory levels to descend when searching]:levels [25]' \
+ '(--noheading)--nofilename[suppress printing of filenames]' \
+ '(-f --follow)'{-f,--follow}'[follow symlinks]' \
+ '(-F --fixed-strings --literal -Q)'{--fixed-strings,-F,--literal,-Q}'[use literal strings]' \
+ '--nogroup[repeat filename for each match line]' \
+ '(1 -G --file-search-regex)-g+[print filenames matching a pattern]:regex' \
+ '(-G --file-search-regex)'{-G+,--file-search-regex=}'[limit search to filenames matching pattern]:regex' \
+ '(-H --heading --noheading)'{-H,--heading}'[print filename with each match]' \
+ '(-H --heading --noheading --nofilename)--noheading[suppress printing of filenames]' \
+ '--hidden[search hidden files (obeying .*ignore files)]' \
+ {--ignore=,--ignore-dir=}'[ignore files/directories matching pattern]:regex' \
+ '(-i --ignore-case)'{-i,--ignore-case}'[match case-insensitively]' \
+ '(-l --files-with-matches)'{-l,--files-with-matches}"[output matching files' names only]" \
+ '(-L --files-without-matches)'{-L,--files-without-matches}"[output non-matching files' names only]" \
+ '(--max-count -m)'{--max-count=,-m+}'[stop after specified no of matches in each file]:max number of matches' \
+ '--numbers[prefix output with line numbers, even for streams]' \
+ '--nonumbers[suppress printing of line numbers]' \
+ '(--only-matching -o)'{--only-matching,-o}'[show only matching part of line]' \
+ '(-p --path-to-ignore)'{-p+,--path-to-ignore=}'[use specified .ignore file]:file:_files' \
+ '--print-long-lines[print matches on very long lines]' \
+ "--passthrough[when searching a stream, print all lines even if they don't match]" \
+ '(-s --case-sensitive)'{-s,--case-sensitive}'[match case]' \
+ '--silent[suppress all log messages, including errors]' \
+ '(--stats-only)--stats[print stats (files scanned, time taken, etc.)]' \
+ '(--stats)--stats-only[print stats and nothing else]' \
+ '(-U --skip-vcs-ignores)'{-U,--skip-vcs-ignores}'[ignore VCS files (stil obey .ignore)]' \
+ '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
+ '--vimgrep[output results like vim :vimgrep /pattern/g would]' \
+ '(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \
+ '(-z --search-zip)'{-z,--search-zip}'[search contents of compressed files]' \
+ '(-0 --null)'{-0,--null}'[separate filenames with null]' \
+ ': :_guard "^-*" pattern' \
+ '*:file:_files' \
+ '(- :)--list-file-types[list supported file types]' \
+ '(- :)'{-h,--help}'[display help information]' \
+ '(- :)'{-V,--version}'[display version information]' \
+ - '(ignores)' \
+ '(-a --all-types)'{-a,--all-types}'[search all files]' \
+ '--search-binary[search binary files for matches]' \
+ {-t,--all-text}'[search all text files (not including hidden files)]' \
+ {-u,--unrestricted}'[search all files]' && ret=0
+
+ _requested file-types && { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
+ [[ -prefix - ]] } && _all_labels file-types expl 'file type' \
+ compadd - ${(M)$(_call_program file-types $words[1] --list-file-types):#--*} && ret=0
+
+ (( ret )) || break
+done
+
+return ret
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/configure new/the_silver_searcher-1.0.2/configure
--- old/the_silver_searcher-0.33.0/configure 2016-09-24 22:33:17.000000000 +0200
+++ new/the_silver_searcher-1.0.2/configure 2016-12-03 23:41:19.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for the_silver_searcher 0.33.0.
+# Generated by GNU Autoconf 2.69 for the_silver_searcher 1.0.2.
#
# Report bugs to https://github.com/ggreer/the_silver_searcher/issues.
#
@@ -581,8 +581,8 @@
# Identity of this package.
PACKAGE_NAME='the_silver_searcher'
PACKAGE_TARNAME='the_silver_searcher'
-PACKAGE_VERSION='0.33.0'
-PACKAGE_STRING='the_silver_searcher 0.33.0'
+PACKAGE_VERSION='1.0.2'
+PACKAGE_STRING='the_silver_searcher 1.0.2'
PACKAGE_BUGREPORT='https://github.com/ggreer/the_silver_searcher/issues'
PACKAGE_URL='https://github.com/ggreer/the_silver_searcher'
@@ -1297,7 +1297,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures the_silver_searcher 0.33.0 to adapt to many kinds of systems.
+\`configure' configures the_silver_searcher 1.0.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1368,7 +1368,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of the_silver_searcher 0.33.0:";;
+ short | recursive ) echo "Configuration of the_silver_searcher 1.0.2:";;
esac
cat <<\_ACEOF
@@ -1471,7 +1471,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-the_silver_searcher configure 0.33.0
+the_silver_searcher configure 1.0.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1943,7 +1943,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by the_silver_searcher $as_me 0.33.0, which was
+It was created by the_silver_searcher $as_me 1.0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2807,7 +2807,7 @@
# Define the identity of the package.
PACKAGE='the_silver_searcher'
- VERSION='0.33.0'
+ VERSION='1.0.2'
# Some tools Automake needs.
@@ -6107,7 +6107,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by the_silver_searcher $as_me 0.33.0, which was
+This file was extended by the_silver_searcher $as_me 1.0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6174,7 +6174,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-the_silver_searcher config.status 0.33.0
+the_silver_searcher config.status 1.0.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/configure.ac new/the_silver_searcher-1.0.2/configure.ac
--- old/the_silver_searcher-0.33.0/configure.ac 2016-09-24 22:03:14.000000000 +0200
+++ new/the_silver_searcher-1.0.2/configure.ac 2016-12-03 23:40:54.000000000 +0100
@@ -1,6 +1,6 @@
AC_INIT(
[the_silver_searcher],
- [0.33.0],
+ [1.0.2],
[https://github.com/ggreer/the_silver_searcher/issues],
[the_silver_searcher],
[https://github.com/ggreer/the_silver_searcher])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/doc/ag.1 new/the_silver_searcher-1.0.2/doc/ag.1
--- old/the_silver_searcher-0.33.0/doc/ag.1 2016-09-25 02:18:03.000000000 +0200
+++ new/the_silver_searcher-1.0.2/doc/ag.1 2016-12-03 22:40:04.000000000 +0100
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "AG" "1" "September 2016" "" ""
+.TH "AG" "1" "December 2016" "" ""
.
.SH "NAME"
\fBag\fR \- The Silver Searcher\. Like ack, but faster\.
.
.SH "SYNOPSIS"
-\fBag\fR [\fIfile\-type\fR] [\fIoptions\fR] PATTERN [PATH]
+\fBag\fR [\fIoptions\fR] \fIpattern\fR [\fIpath \.\.\.\fR]
.
.SH "DESCRIPTION"
Recursively search for PATTERN in PATH\. Like grep or ack, but faster\.
@@ -136,7 +136,7 @@
.
.TP
\fB\-\-[no]mmap\fR
-Toggle use of memory\-mapped I/O\. Defaults to true\.
+Toggle use of memory\-mapped I/O\. Defaults to true on platforms where \fBmmap()\fR is faster than \fBread()\fR\. (All but macOS\.)
.
.TP
\fB\-\-[no]multiline\fR
@@ -184,7 +184,7 @@
.
.TP
\fB\-r \-\-recurse\fR
-Recurse into directories when seacrhing\. Default is true\.
+Recurse into directories when searching\. Default is true\.
.
.TP
\fB\-s \-\-case\-sensitive\fR
@@ -220,7 +220,7 @@
.
.TP
\fB\-U \-\-skip\-vcs\-ignores\fR
-Ignore VCS ignore files (\.gitignore, \.hgignore, svn:ignore), but still use \.ignore\.
+Ignore VCS ignore files (\.gitignore, \.hgignore), but still use \.ignore\.
.
.TP
\fB\-v \-\-invert\-match\fR
@@ -260,13 +260,13 @@
Separate the filenames with \fB\e0\fR, rather than \fB\en\fR: this allows \fBxargs \-0 <command>\fR to correctly process filenames containing spaces or newlines\.
.
.SH "FILE TYPES"
-It is possible to restrict the types of files searched\. For example, passing \fB\-\-html\fR as the \fBfile\-types\fR parameter will search only files with the extensions \fBhtm\fR, \fBhtml\fR, \fBshtml\fR or \fBxhtml\fR\. For a list of supported types, run \fBag \-\-list\-file\-types\fR\.
+It is possible to restrict the types of files searched\. For example, passing \fB\-\-html\fR will search only files with the extensions \fBhtm\fR, \fBhtml\fR, \fBshtml\fR or \fBxhtml\fR\. For a list of supported types, run \fBag \-\-list\-file\-types\fR\.
.
.SH "IGNORING FILES"
-By default, ag will ignore files whose names match patterns in \.gitignore, \.hgignore, or \.ignore\. These files can be anywhere in the directories being searched\. Ag also ignores files matched by the svn:ignore property if \fBsvn \-\-version\fR is 1\.6 or older\. Finally, ag looks in $HOME/\.agignore for ignore patterns\. Binary files are ignored by default as well\.
+By default, ag will ignore files whose names match patterns in \.gitignore, \.hgignore, or \.ignore\. These files can be anywhere in the directories being searched\. Binary files are ignored by default as well\. Finally, ag looks in $HOME/\.agignore for ignore patterns\.
.
.P
-If you want to ignore \.gitignore, \.hgignore, and svn:ignore, but still take \.ignore into account, use \fB\-U\fR\.
+If you want to ignore \.gitignore and \.hgignore, but still take \.ignore into account, use \fB\-U\fR\.
.
.P
Use the \fB\-t\fR option to search all text files; \fB\-a\fR to search all files; and \fB\-u\fR to search all, including hidden files\.
@@ -277,5 +277,11 @@
.P
\fBag foo /bar/\fR: Find matches for "foo" in path /bar/\.
.
+.P
+\fBag \-\- \-\-foo\fR: Find matches for "\-\-foo" in the current directory\. (As with most UNIX command line utilities, "\-\-" is used to signify that the remaining arguments should not be treated as options\.)
+.
+.SH "ABOUT"
+ag was originally created by Geoff Greer\. More information (and the latest release) can be found at http://geoff\.greer\.fm/ag
+.
.SH "SEE ALSO"
grep(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/ignore.c new/the_silver_searcher-1.0.2/src/ignore.c
--- old/the_silver_searcher-0.33.0/src/ignore.c 2016-09-24 22:30:46.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/ignore.c 2016-12-03 21:46:47.000000000 +0100
@@ -36,7 +36,6 @@
".gitignore",
".git/info/exclude",
".hgignore",
- ".svn",
NULL
};
@@ -189,84 +188,6 @@
fclose(fp);
}
-void load_svn_ignore_patterns(ignores *ig, const char *path) {
- FILE *fp = NULL;
- char *dir_prop_base;
- ag_asprintf(&dir_prop_base, "%s/%s", path, SVN_DIR_PROP_BASE);
-
- fp = fopen(dir_prop_base, "r");
- if (fp == NULL) {
- log_debug("Skipping svn ignore file %s", dir_prop_base);
- free(dir_prop_base);
- return;
- }
-
- char *entry = NULL;
- size_t entry_len = 0;
- char *key = ag_malloc(32); /* Sane start for max key length. */
- size_t key_len = 0;
- size_t bytes_read = 0;
- char *entry_line;
- size_t line_len;
- int matches;
-
- while (fscanf(fp, "K %zu\n", &key_len) == 1) {
- if (key_len >= INT_MAX) {
- log_debug("Unable to parse svnignore file %s: key is absurdly long.", dir_prop_base);
- goto cleanup;
- }
- key = ag_realloc(key, key_len + 1);
- bytes_read = fread(key, 1, key_len, fp);
- key[key_len] = '\0';
- matches = fscanf(fp, "\nV %zu\n", &entry_len);
- if (matches != 1) {
- log_debug("Unable to parse svnignore file %s: fscanf() got %i matches, expected 1.", dir_prop_base, matches);
- goto cleanup;
- }
-
- if (strncmp(SVN_PROP_IGNORE, key, bytes_read) != 0) {
- log_debug("key is %s, not %s. skipping %u bytes", key, SVN_PROP_IGNORE, entry_len);
- /* Not the key we care about. fseek and repeat */
- int rv = fseek(fp, entry_len + 1, SEEK_CUR); /* +1 to account for newline. yes I know this is hacky */
- if (rv == -1) {
- log_debug("Skipping svnignore file %s: fseek() error.", dir_prop_base);
- goto cleanup;
- }
- continue;
- }
- /* Aww yeah. Time to ignore stuff */
- entry = ag_malloc(entry_len + 1);
- bytes_read = fread(entry, 1, entry_len, fp);
- entry[bytes_read] = '\0';
- log_debug("entry: %s", entry);
- break;
- }
- if (entry == NULL) {
- goto cleanup;
- }
- char *patterns = entry;
- size_t patterns_len = strlen(patterns);
- while (*patterns != '\0' && patterns < (entry + bytes_read)) {
- for (line_len = 0; line_len < patterns_len; line_len++) {
- if (patterns[line_len] == '\n') {
- break;
- }
- }
- if (line_len > 0) {
- entry_line = ag_strndup(patterns, line_len);
- add_ignore_pattern(ig, entry_line);
- free(entry_line);
- }
- patterns += line_len + 1;
- patterns_len -= line_len + 1;
- }
- free(entry);
-cleanup:
- free(dir_prop_base);
- free(key);
- fclose(fp);
-}
-
static int ackmate_dir_match(const char *dir_name) {
if (opts.ackmate_dir_filter == NULL) {
return 0;
@@ -365,7 +286,7 @@
}
if (is_named_pipe(path, dir)) {
- log_debug("%s ignored because it's a named pipe", path);
+ log_debug("%s ignored because it's a named pipe or socket", path);
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/ignore.h new/the_silver_searcher-1.0.2/src/ignore.h
--- old/the_silver_searcher-0.33.0/src/ignore.h 2016-05-10 19:39:41.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/ignore.h 2016-11-28 06:07:11.000000000 +0100
@@ -4,10 +4,6 @@
#include
#include
-#define SVN_DIR_PROP_BASE "dir-prop-base"
-#define SVN_DIR ".svn"
-#define SVN_PROP_IGNORE "svn:ignore"
-
struct ignores {
char **extensions; /* File extensions to ignore */
size_t extensions_len;
@@ -42,7 +38,6 @@
void add_ignore_pattern(ignores *ig, const char *pattern);
void load_ignore_patterns(ignores *ig, const char *path);
-void load_svn_ignore_patterns(ignores *ig, const char *path);
int filename_filter(const char *path, const struct dirent *dir, void *baton);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/lang.c new/the_silver_searcher-1.0.2/src/lang.c
--- old/the_silver_searcher-0.33.0/src/lang.c 2016-07-09 19:51:01.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/lang.c 2016-11-28 06:07:11.000000000 +0100
@@ -16,12 +16,12 @@
{ "chpl", { "chpl" } },
{ "clojure", { "clj", "cljs", "cljc", "cljx" } },
{ "coffee", { "coffee", "cjsx" } },
- { "cpp", { "cpp", "cc", "C", "cxx", "m", "hpp", "hh", "h", "H", "hxx" } },
+ { "cpp", { "cpp", "cc", "C", "cxx", "m", "hpp", "hh", "h", "H", "hxx", "tpp" } },
{ "crystal", { "cr", "ecr" } },
{ "csharp", { "cs" } },
{ "css", { "css" } },
{ "cython", { "pyx", "pxd", "pxi" } },
- { "delphi", { "pas", "int", "dfm", "nfm", "dof", "dpk", "dproj", "groupproj", "bdsgroup", "bdsproj" } },
+ { "delphi", { "pas", "int", "dfm", "nfm", "dof", "dpk", "dpr", "dproj", "groupproj", "bdsgroup", "bdsproj" } },
{ "ebuild", { "ebuild", "eclass" } },
{ "elisp", { "el" } },
{ "elixir", { "ex", "eex", "exs" } },
@@ -30,6 +30,7 @@
{ "fortran", { "f", "f77", "f90", "f95", "f03", "for", "ftn", "fpp" } },
{ "fsharp", { "fs", "fsi", "fsx" } },
{ "gettext", { "po", "pot", "mo" } },
+ { "glsl", { "vert", "tesc", "tese", "geom", "frag", "comp" } },
{ "go", { "go" } },
{ "groovy", { "groovy", "gtmpl", "gpp", "grunit" } },
{ "haml", { "haml" } },
@@ -66,6 +67,7 @@
{ "php", { "php", "phpt", "php3", "php4", "php5", "phtml" } },
{ "pike", { "pike", "pmod" } },
{ "plone", { "pt", "cpt", "metadata", "cpy", "py", "xml", "zcml" } },
+ { "proto", { "proto" } },
{ "puppet", { "pp" } },
{ "python", { "py" } },
{ "qml", { "qml" } },
@@ -101,7 +103,7 @@
{ "wix", { "wxi", "wxs" } },
{ "wsdl", { "wsdl" } },
{ "wadl", { "wadl" } },
- { "xml", { "xml", "dtd", "xsl", "xslt", "ent" } },
+ { "xml", { "xml", "dtd", "xsl", "xslt", "ent", "tld" } },
{ "yaml", { "yaml", "yml" } }
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/main.c new/the_silver_searcher-1.0.2/src/main.c
--- old/the_silver_searcher-0.33.0/src/main.c 2016-09-24 02:56:42.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/main.c 2016-12-03 21:46:47.000000000 +0100
@@ -115,6 +115,7 @@
generate_alpha_skip(opts.query, opts.query_len, alpha_skip_lookup, opts.casing == CASE_SENSITIVE);
find_skip_lookup = NULL;
generate_find_skip(opts.query, opts.query_len, &find_skip_lookup, opts.casing == CASE_SENSITIVE);
+ generate_hash(opts.query, opts.query_len, h_table, opts.casing == CASE_SENSITIVE);
if (opts.word_regexp) {
init_wordchar_table();
opts.literal_starts_wordchar = is_wordchar(opts.query[0]);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/options.c new/the_silver_searcher-1.0.2/src/options.c
--- old/the_silver_searcher-0.33.0/src/options.c 2016-09-25 01:55:10.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/options.c 2016-12-03 22:54:24.000000000 +0100
@@ -102,7 +102,7 @@
-u --unrestricted Search all files (ignore .ignore, .gitignore, etc.;\n\
searches binary and hidden files as well)\n\
-U --skip-vcs-ignores Ignore VCS ignore files\n\
- (.gitignore, .hgignore, .svnignore; still obey .ignore)\n\
+ (.gitignore, .hgignore; still obey .ignore)\n\
-v --invert-match\n\
-w --word-regexp Only match whole words\n\
-W --width NUM Truncate match lines after NUM characters\n\
@@ -114,7 +114,9 @@
- Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml.\n\
\n\
For a list of supported file types run:\n\
- ag --list-file-types\n\n");
+ ag --list-file-types\n\n\
+ag was originally created by Geoff Greer. More information (and the latest release)\n\
+can be found at http://geoff.greer.fm/ag\n");
}
void print_version(void) {
@@ -144,7 +146,12 @@
opts.color_win_ansi = FALSE;
opts.max_matches_per_file = 0;
opts.max_search_depth = DEFAULT_MAX_SEARCH_DEPTH;
+#if defined(__APPLE__) || defined(__MACH__)
+ /* mamp() is slower than normal read() on macos. default to off */
+ opts.mmap = FALSE;
+#else
opts.mmap = TRUE;
+#endif
opts.multiline = TRUE;
opts.width = 0;
opts.path_sep = '\n';
@@ -260,20 +267,30 @@
{ "max-count", required_argument, NULL, 'm' },
{ "mmap", no_argument, &opts.mmap, TRUE },
{ "multiline", no_argument, &opts.multiline, TRUE },
- /* "no-" is deprecated. Remove these eventually. */
- { "no-numbers", no_argument, &opts.print_line_numbers, FALSE },
- { "no-recurse", no_argument, NULL, 'n' },
+ /* Accept both --no-* and --no* forms for convenience/BC */
+ { "no-affinity", no_argument, &opts.use_thread_affinity, 0 },
{ "noaffinity", no_argument, &opts.use_thread_affinity, 0 },
+ { "no-break", no_argument, &opts.print_break, 0 },
{ "nobreak", no_argument, &opts.print_break, 0 },
+ { "no-color", no_argument, &opts.color, 0 },
{ "nocolor", no_argument, &opts.color, 0 },
+ { "no-filename", no_argument, NULL, 0 },
{ "nofilename", no_argument, NULL, 0 },
+ { "no-follow", no_argument, &opts.follow_symlinks, 0 },
{ "nofollow", no_argument, &opts.follow_symlinks, 0 },
+ { "no-group", no_argument, &group, 0 },
{ "nogroup", no_argument, &group, 0 },
+ { "no-heading", no_argument, &opts.print_path, PATH_PRINT_EACH_LINE },
{ "noheading", no_argument, &opts.print_path, PATH_PRINT_EACH_LINE },
+ { "no-mmap", no_argument, &opts.mmap, FALSE },
{ "nommap", no_argument, &opts.mmap, FALSE },
+ { "no-multiline", no_argument, &opts.multiline, FALSE },
{ "nomultiline", no_argument, &opts.multiline, FALSE },
+ { "no-numbers", no_argument, &opts.print_line_numbers, FALSE },
{ "nonumbers", no_argument, &opts.print_line_numbers, FALSE },
+ { "no-pager", no_argument, NULL, 0 },
{ "nopager", no_argument, NULL, 0 },
+ { "no-recurse", no_argument, NULL, 'n' },
{ "norecurse", no_argument, NULL, 'n' },
{ "null", no_argument, NULL, '0' },
{ "numbers", no_argument, &opts.print_line_numbers, 2 },
@@ -427,6 +444,7 @@
case 'l':
needs_query = 0;
opts.print_filename_only = 1;
+ opts.print_path = PATH_PRINT_TOP;
break;
case 'm':
opts.max_matches_per_file = atoi(optarg);
@@ -435,7 +453,8 @@
opts.recurse_dirs = 0;
break;
case 'p':
- opts.path_to_ignore = optarg;
+ opts.path_to_ignore = TRUE;
+ load_ignore_patterns(root_ignores, optarg);
break;
case 'o':
opts.only_matching = 1;
@@ -505,11 +524,13 @@
} else if (strcmp(longopts[opt_index].name, "ignore") == 0) {
add_ignore_pattern(root_ignores, optarg);
break;
- } else if (strcmp(longopts[opt_index].name, "nofilename") == 0) {
+ } else if (strcmp(longopts[opt_index].name, "no-filename") == 0 ||
+ strcmp(longopts[opt_index].name, "nofilename") == 0) {
opts.print_path = PATH_PRINT_NOTHING;
opts.print_line_numbers = FALSE;
break;
- } else if (strcmp(longopts[opt_index].name, "nopager") == 0) {
+ } else if (strcmp(longopts[opt_index].name, "no-pager") == 0 ||
+ strcmp(longopts[opt_index].name, "nopager") == 0) {
out_fd = stdout;
opts.pager = NULL;
break;
@@ -647,7 +668,7 @@
if (home_dir && !opts.search_all_files) {
log_debug("Found user's home dir: %s", home_dir);
- ag_asprintf(&ignore_file_path, "%s/%s", home_dir, ignore_pattern_files[0]);
+ ag_asprintf(&ignore_file_path, "%s/.agignore", home_dir);
load_ignore_patterns(root_ignores, ignore_file_path);
free(ignore_file_path);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/options.h new/the_silver_searcher-1.0.2/src/options.h
--- old/the_silver_searcher-0.33.0/src/options.h 2016-09-24 22:30:36.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/options.h 2016-12-03 21:46:47.000000000 +0100
@@ -56,7 +56,7 @@
int one_dev;
int only_matching;
char path_sep;
- char *path_to_ignore;
+ int path_to_ignore;
int print_break;
int print_count;
int print_filename_only;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/print.c new/the_silver_searcher-1.0.2/src/print.c
--- old/the_silver_searcher-0.33.0/src/print.c 2016-06-23 20:33:43.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/print.c 2016-12-03 23:40:19.000000000 +0100
@@ -8,6 +8,7 @@
#include "log.h"
#include "options.h"
#include "print.h"
+#include "search.h"
#include "util.h"
#ifdef _WIN32
#define fprintf(...) fprintf_w32(__VA_ARGS__)
@@ -19,6 +20,84 @@
const char *truncate_marker = " [...]";
+__thread struct print_context {
+ size_t line;
+ char **context_prev_lines;
+ size_t prev_line;
+ size_t last_prev_line;
+ size_t prev_line_offset;
+ size_t lines_since_last_match;
+ size_t last_printed_match;
+ int in_a_match;
+ int printing_a_match;
+} print_context;
+
+void print_init_context(void) {
+ if (print_context.context_prev_lines != NULL) {
+ return;
+ }
+ print_context.context_prev_lines = ag_calloc(sizeof(char *), (opts.before + 1));
+ print_context.line = 1;
+ print_context.prev_line = 0;
+ print_context.last_prev_line = 0;
+ print_context.prev_line_offset = 0;
+ print_context.lines_since_last_match = INT_MAX;
+ print_context.last_printed_match = 0;
+ print_context.in_a_match = FALSE;
+ print_context.printing_a_match = FALSE;
+}
+
+void print_cleanup_context(void) {
+ size_t i;
+
+ if (print_context.context_prev_lines == NULL) {
+ return;
+ }
+
+ for (i = 0; i < opts.before; i++) {
+ if (print_context.context_prev_lines[i] != NULL) {
+ free(print_context.context_prev_lines[i]);
+ }
+ }
+ free(print_context.context_prev_lines);
+ print_context.context_prev_lines = NULL;
+}
+
+void print_context_append(const char *line, size_t len) {
+ if (opts.before == 0) {
+ return;
+ }
+ if (print_context.context_prev_lines[print_context.last_prev_line] != NULL) {
+ free(print_context.context_prev_lines[print_context.last_prev_line]);
+ }
+ print_context.context_prev_lines[print_context.last_prev_line] = ag_strndup(line, len);
+ print_context.last_prev_line = (print_context.last_prev_line + 1) % opts.before;
+}
+
+void print_trailing_context(const char *path, const char *buf, size_t n) {
+ char sep = '-';
+
+ if (opts.ackmate || opts.vimgrep) {
+ sep = ':';
+ }
+
+ if (print_context.lines_since_last_match != 0 &&
+ print_context.lines_since_last_match <= opts.after) {
+ if (opts.print_path == PATH_PRINT_EACH_LINE) {
+ print_path(path, ':');
+ }
+ print_line_number(print_context.line, sep);
+
+ fwrite(buf, 1, n, out_fd);
+ fputc('\n', out_fd);
+ }
+
+ print_context.line++;
+ if (!print_context.in_a_match && print_context.lines_since_last_match < INT_MAX) {
+ print_context.lines_since_last_match++;
+ }
+}
+
void print_path(const char *path, const char sep) {
if (opts.print_path == PATH_PRINT_NOTHING && !opts.vimgrep) {
return;
@@ -65,19 +144,10 @@
}
void print_file_matches(const char *path, const char *buf, const size_t buf_len, const match_t matches[], const size_t matches_len) {
- size_t line = 1;
- char **context_prev_lines = NULL;
- size_t prev_line = 0;
- size_t last_prev_line = 0;
- size_t prev_line_offset = 0;
size_t cur_match = 0;
- size_t lines_since_last_match = INT_MAX;
ssize_t lines_to_print = 0;
- size_t last_printed_match = 0;
char sep = '-';
size_t i, j;
- int in_a_match = FALSE;
- int printing_a_match = FALSE;
if (opts.ackmate || opts.vimgrep) {
sep = ':';
@@ -99,20 +169,18 @@
}
}
- context_prev_lines = ag_calloc(sizeof(char *), (opts.before + 1));
-
- for (i = 0; i <= buf_len && (cur_match < matches_len || lines_since_last_match <= opts.after); i++) {
+ for (i = 0; i <= buf_len && (cur_match < matches_len || print_context.lines_since_last_match <= opts.after); i++) {
if (cur_match < matches_len && i == matches[cur_match].start) {
- in_a_match = TRUE;
+ print_context.in_a_match = TRUE;
/* We found the start of a match */
- if (cur_match > 0 && opts.context && lines_since_last_match > (opts.before + opts.after + 1)) {
+ if (cur_match > 0 && opts.context && print_context.lines_since_last_match > (opts.before + opts.after + 1)) {
fprintf(out_fd, "--\n");
}
- if (lines_since_last_match > 0 && opts.before > 0) {
+ if (print_context.lines_since_last_match > 0 && opts.before > 0) {
/* TODO: better, but still needs work */
/* print the previous line(s) */
- lines_to_print = lines_since_last_match - (opts.after + 1);
+ lines_to_print = print_context.lines_since_last_match - (opts.after + 1);
if (lines_to_print < 0) {
lines_to_print = 0;
} else if ((size_t)lines_to_print > opts.before) {
@@ -120,80 +188,76 @@
}
for (j = (opts.before - lines_to_print); j < opts.before; j++) {
- prev_line = (last_prev_line + j) % opts.before;
- if (context_prev_lines[prev_line] != NULL) {
+ print_context.prev_line = (print_context.last_prev_line + j) % opts.before;
+ if (print_context.context_prev_lines[print_context.prev_line] != NULL) {
if (opts.print_path == PATH_PRINT_EACH_LINE) {
print_path(path, ':');
}
- print_line_number(line - (opts.before - j), sep);
- fprintf(out_fd, "%s\n", context_prev_lines[prev_line]);
+ print_line_number(print_context.line - (opts.before - j), sep);
+ fprintf(out_fd, "%s\n", print_context.context_prev_lines[print_context.prev_line]);
}
}
}
- lines_since_last_match = 0;
+ print_context.lines_since_last_match = 0;
}
if (cur_match < matches_len && i == matches[cur_match].end) {
/* We found the end of a match. */
cur_match++;
- in_a_match = FALSE;
+ print_context.in_a_match = FALSE;
}
/* We found the end of a line. */
if ((i == buf_len || buf[i] == '\n') && opts.before > 0) {
- if (context_prev_lines[last_prev_line] != NULL) {
- free(context_prev_lines[last_prev_line]);
- }
/* We don't want to strcpy the \n */
- context_prev_lines[last_prev_line] = ag_strndup(&buf[prev_line_offset], i - prev_line_offset);
- last_prev_line = (last_prev_line + 1) % opts.before;
+ print_context_append(&buf[print_context.prev_line_offset], i - print_context.prev_line_offset);
}
if (i == buf_len || buf[i] == '\n') {
- if (lines_since_last_match == 0) {
+ if (print_context.lines_since_last_match == 0) {
if (opts.print_path == PATH_PRINT_EACH_LINE && !opts.search_stream) {
print_path(path, ':');
}
if (opts.ackmate) {
/* print headers for ackmate to parse */
- print_line_number(line, ';');
- for (; last_printed_match < cur_match; last_printed_match++) {
+ print_line_number(print_context.line, ';');
+ for (; print_context.last_printed_match < cur_match; print_context.last_printed_match++) {
/* Don't print negative offsets. This isn't quite right, but not many people use --ackmate */
- long start = (long)(matches[last_printed_match].start - prev_line_offset);
+ long start = (long)(matches[print_context.last_printed_match].start - print_context.prev_line_offset);
if (start < 0) {
start = 0;
}
fprintf(out_fd, "%li %li",
start,
- (long)(matches[last_printed_match].end - matches[last_printed_match].start));
- last_printed_match == cur_match - 1 ? fputc(':', out_fd) : fputc(',', out_fd);
+ (long)(matches[print_context.last_printed_match].end - matches[print_context.last_printed_match].start));
+ print_context.last_printed_match == cur_match - 1 ? fputc(':', out_fd) : fputc(',', out_fd);
}
- print_line(buf, i, prev_line_offset);
+ print_line(buf, i, print_context.prev_line_offset);
} else if (opts.vimgrep) {
- for (; last_printed_match < cur_match; last_printed_match++) {
+ for (; print_context.last_printed_match < cur_match; print_context.last_printed_match++) {
print_path(path, sep);
- print_line_number(line, sep);
- print_column_number(matches, last_printed_match, prev_line_offset, sep);
- print_line(buf, i, prev_line_offset);
+ print_line_number(print_context.line, sep);
+ print_column_number(matches, print_context.last_printed_match, print_context.prev_line_offset, sep);
+ print_line(buf, i, print_context.prev_line_offset);
}
} else {
- print_line_number(line, ':');
+ print_line_number(print_context.line, ':');
int printed_match = FALSE;
if (opts.column) {
- print_column_number(matches, last_printed_match, prev_line_offset, ':');
+ print_column_number(matches, print_context.last_printed_match, print_context.prev_line_offset, ':');
}
- if (printing_a_match && opts.color) {
+ if (print_context.printing_a_match && opts.color) {
fprintf(out_fd, "%s", opts.color_match);
}
- for (j = prev_line_offset; j <= i; j++) {
+ for (j = print_context.prev_line_offset; j <= i; j++) {
/* close highlight of match term */
- if (last_printed_match < matches_len && j == matches[last_printed_match].end) {
+ if (print_context.last_printed_match < matches_len && j == matches[print_context.last_printed_match].end) {
if (opts.color) {
fprintf(out_fd, "%s", color_reset);
}
- printing_a_match = FALSE;
- last_printed_match++;
+ print_context.printing_a_match = FALSE;
+ print_context.last_printed_match++;
printed_match = TRUE;
if (opts.only_matching) {
fputc('\n', out_fd);
@@ -201,7 +265,7 @@
}
/* skip remaining characters if truncation width exceeded, needs to be done
* before highlight opening */
- if (j < buf_len && opts.width > 0 && j - prev_line_offset >= opts.width) {
+ if (j < buf_len && opts.width > 0 && j - print_context.prev_line_offset >= opts.width) {
if (j < i) {
fputs(truncate_marker, out_fd);
}
@@ -209,78 +273,66 @@
/* prevent any more characters or highlights */
j = i;
- last_printed_match = matches_len;
+ print_context.last_printed_match = matches_len;
}
/* open highlight of match term */
- if (last_printed_match < matches_len && j == matches[last_printed_match].start) {
+ if (print_context.last_printed_match < matches_len && j == matches[print_context.last_printed_match].start) {
if (opts.only_matching && printed_match) {
if (opts.print_path == PATH_PRINT_EACH_LINE) {
print_path(path, ':');
}
- print_line_number(line, ':');
+ print_line_number(print_context.line, ':');
if (opts.column) {
- print_column_number(matches, last_printed_match, prev_line_offset, ':');
+ print_column_number(matches, print_context.last_printed_match, print_context.prev_line_offset, ':');
}
}
if (opts.color) {
fprintf(out_fd, "%s", opts.color_match);
}
- printing_a_match = TRUE;
+ print_context.printing_a_match = TRUE;
}
/* Don't print the null terminator */
if (j < buf_len) {
/* if only_matching is set, print only matches and newlines */
- if (!opts.only_matching || printing_a_match) {
- if (opts.width == 0 || j - prev_line_offset < opts.width) {
+ if (!opts.only_matching || print_context.printing_a_match) {
+ if (opts.width == 0 || j - print_context.prev_line_offset < opts.width) {
fputc(buf[j], out_fd);
}
}
}
}
- if (printing_a_match && opts.color) {
+ if (print_context.printing_a_match && opts.color) {
fprintf(out_fd, "%s", color_reset);
}
}
- } else if (lines_since_last_match <= opts.after) {
- /* print context after matching line */
- if (opts.print_path == PATH_PRINT_EACH_LINE) {
- print_path(path, ':');
- }
- print_line_number(line, sep);
-
- for (j = prev_line_offset; j < i; j++) {
- fputc(buf[j], out_fd);
- }
- fputc('\n', out_fd);
}
- prev_line_offset = i + 1; /* skip the newline */
- line++;
- if (!in_a_match && lines_since_last_match < INT_MAX) {
- lines_since_last_match++;
+ if (opts.search_stream) {
+ print_context.last_printed_match = 0;
+ break;
}
+
+ /* print context after matching line */
+ print_trailing_context(path, &buf[print_context.prev_line_offset], i - print_context.prev_line_offset);
+
+ print_context.prev_line_offset = i + 1; /* skip the newline */
+
/* File doesn't end with a newline. Print one so the output is pretty. */
- if (i == buf_len && buf[i - 1] != '\n' && !opts.search_stream) {
+ if (i == buf_len && buf[i - 1] != '\n') {
fputc('\n', out_fd);
}
}
}
-
- for (i = 0; i < opts.before; i++) {
- if (context_prev_lines[i] != NULL) {
- free(context_prev_lines[i]);
- }
+ /* Flush output if stdout is not a tty */
+ if (opts.stdout_inode) {
+ fflush(out_fd);
}
- free(context_prev_lines);
}
void print_line_number(size_t line, const char sep) {
if (!opts.print_line_numbers) {
return;
}
- if (opts.search_stream && opts.stream_line_num) {
- line = opts.stream_line_num;
- }
if (opts.color) {
fprintf(out_fd, "%s%lu%s%c", opts.color_line_number, (unsigned long)line, color_reset, sep);
} else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/print.h new/the_silver_searcher-1.0.2/src/print.h
--- old/the_silver_searcher-0.33.0/src/print.h 2016-05-10 19:39:37.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/print.h 2016-11-28 06:07:11.000000000 +0100
@@ -3,6 +3,10 @@
#include "util.h"
+void print_init_context(void);
+void print_cleanup_context(void);
+void print_context_append(const char *line, size_t len);
+void print_trailing_context(const char *path, const char *buf, size_t n);
void print_path(const char *path, const char sep);
void print_path_count(const char *path, const char sep, const size_t count);
void print_line(const char *buf, size_t buf_pos, size_t prev_line_offset);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/search.c new/the_silver_searcher-1.0.2/src/search.c
--- old/the_silver_searcher-0.33.0/src/search.c 2016-09-24 22:33:08.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/search.c 2016-12-03 23:40:19.000000000 +0100
@@ -1,4 +1,5 @@
#include "search.h"
+#include "print.h"
#include "scandir.h"
void search_buf(const char *buf, const size_t buf_len,
@@ -47,7 +48,17 @@
strncmp_fp ag_strnstr_fp = get_strstr(opts.casing);
while (buf_offset < buf_len) {
+/* hash_strnstr only for little-endian platforms that allow unaligned access */
+#if defined(__i386__) || defined(__x86_64__)
+ /* Decide whether to fall back on boyer-moore */
+ if ((size_t)opts.query_len < 2 * sizeof(uint16_t) - 1 || opts.query_len >= UCHAR_MAX)
+ match_ptr = ag_strnstr_fp(match_ptr, opts.query, buf_len - buf_offset, opts.query_len, alpha_skip_lookup, find_skip_lookup);
+ else
+ match_ptr = hash_strnstr(match_ptr, opts.query, buf_len - buf_offset, opts.query_len, h_table, opts.casing == CASE_SENSITIVE);
+#else
match_ptr = ag_strnstr_fp(match_ptr, opts.query, buf_len - buf_offset, opts.query_len, alpha_skip_lookup, find_skip_lookup);
+#endif
+
if (match_ptr == NULL) {
break;
}
@@ -66,8 +77,8 @@
/* It's a match */
} else {
/* It's not a match */
- match_ptr += opts.query_len;
- buf_offset = end - buf;
+ match_ptr += find_skip_lookup[0] - opts.query_len + 1;
+ buf_offset = match_ptr - buf;
continue;
}
}
@@ -196,6 +207,10 @@
log_debug("No match in %s", dir_full_path);
}
+ if (matches_len == 0 && opts.search_stream) {
+ print_context_append(buf, buf_len - 1);
+ }
+
if (matches_size > 0) {
free(matches);
}
@@ -208,12 +223,19 @@
size_t line_cap = 0;
size_t i;
+ print_init_context();
+
for (i = 1; (line_len = getline(&line, &line_cap, stream)) > 0; i++) {
opts.stream_line_num = i;
search_buf(line, line_len, path);
+ if (line[line_len - 1] == '\n') {
+ line_len--;
+ }
+ print_trailing_context(path, line, line_len);
}
free(line);
+ print_cleanup_context();
}
void search_file(const char *file_full_path) {
@@ -247,6 +269,8 @@
goto cleanup;
}
+ print_init_context();
+
if (statbuf.st_mode & S_IFIFO) {
log_debug("%s is a named pipe. stream searching", file_full_path);
fp = fdopen(fd, "r");
@@ -258,7 +282,11 @@
f_len = statbuf.st_size;
if (f_len == 0) {
- log_debug("Skipping %s: file is empty.", file_full_path);
+ if (opts.query[0] == '.' && opts.query_len == 1 && !opts.literal && opts.search_all_files) {
+ search_buf(buf, f_len, file_full_path);
+ } else {
+ log_debug("Skipping %s: file is empty.", file_full_path);
+ }
goto cleanup;
}
@@ -326,6 +354,7 @@
cleanup:
+ print_cleanup_context();
if (buf != NULL) {
#ifdef _WIN32
UnmapViewOfFile(buf);
@@ -452,20 +481,11 @@
for (i = 0; opts.skip_vcs_ignores ? (i <= 1) : (ignore_pattern_files[i] != NULL); i++) {
ignore_file = ignore_pattern_files[i];
ag_asprintf(&dir_full_path, "%s/%s", path, ignore_file);
- if (strcmp(SVN_DIR, ignore_file) == 0) {
- load_svn_ignore_patterns(ig, dir_full_path);
- } else {
- load_ignore_patterns(ig, dir_full_path);
- }
+ load_ignore_patterns(ig, dir_full_path);
free(dir_full_path);
dir_full_path = NULL;
}
- /* TODO: this is extremely wasteful */
- if (opts.path_to_ignore) {
- load_ignore_patterns(ig, opts.path_to_ignore);
- }
-
scandir_baton.ig = ig;
scandir_baton.base_path = base_path;
scandir_baton.base_path_len = base_path ? strlen(base_path) : 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/search.h new/the_silver_searcher-1.0.2/src/search.h
--- old/the_silver_searcher-0.33.0/src/search.h 2016-09-03 17:39:14.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/search.h 2016-12-03 21:46:47.000000000 +0100
@@ -33,6 +33,7 @@
size_t alpha_skip_lookup[256];
size_t *find_skip_lookup;
+uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
struct work_queue_t {
char *path;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/util.c new/the_silver_searcher-1.0.2/src/util.c
--- old/the_silver_searcher-0.33.0/src/util.c 2016-09-02 00:25:39.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/util.c 2016-12-03 21:46:47.000000000 +0100
@@ -148,6 +148,32 @@
return a;
}
+void generate_hash(const char *find, const size_t f_len, uint8_t *h_table, const int case_sensitive) {
+ int i;
+ for (i = f_len - sizeof(uint16_t); i >= 0; i--) {
+ // Add all 2^sizeof(uint16_t) combinations of capital letters to the hash table
+ int caps_set;
+ for (caps_set = 0; caps_set < (1 << sizeof(uint16_t)); caps_set++) {
+ word_t word;
+ memcpy(&word.as_chars, find + i, sizeof(uint16_t));
+ int cap_index;
+ // Capitalize the letters whose corresponding bits in caps_set are 1
+ for (cap_index = 0; caps_set >> cap_index; cap_index++) {
+ if ((caps_set >> cap_index) & 1)
+ word.as_chars[cap_index] -= 'a' - 'A';
+ }
+ size_t h;
+ // Find next free cell
+ for (h = word.as_word % H_SIZE; h_table[h]; h = (h + 1) % H_SIZE)
+ ;
+ h_table[h] = i + 1;
+ // Don't add capital letters if case sensitive
+ if (case_sensitive)
+ break;
+ }
+ }
+}
+
/* Boyer-Moore strstr */
const char *boyer_moore_strnstr(const char *s, const char *find, const size_t s_len, const size_t f_len,
const size_t alpha_skip_lookup[], const size_t *find_skip_lookup) {
@@ -184,6 +210,43 @@
return NULL;
}
+const char *hash_strnstr(const char *s, const char *find, const size_t s_len, const size_t f_len, uint8_t *h_table, const int case_sensitive) {
+ if (s_len < f_len)
+ return NULL;
+
+ // Step through s
+ const size_t step = f_len - sizeof(uint16_t) + 1;
+ size_t s_i = f_len - sizeof(uint16_t);
+ for (; s_i <= s_len - f_len; s_i += step) {
+ size_t h;
+ for (h = *(const uint16_t *)(s + s_i) % H_SIZE; h_table[h]; h = (h + 1) % H_SIZE) {
+ const char *R = s + s_i - (h_table[h] - 1);
+ size_t i;
+ // Check putative match
+ for (i = 0; i < f_len; i++) {
+ if ((case_sensitive ? R[i] : tolower(R[i])) != find[i])
+ goto next_hash_cell;
+ }
+ return R; // Found
+ next_hash_cell:;
+ }
+ }
+ // Check tail
+ for (s_i = s_i - step + 1; s_i <= s_len - f_len; s_i++) {
+ size_t i;
+ const char *R = s + s_i;
+ for (i = 0; i < f_len; i++) {
+ char s_c = case_sensitive ? R[i] : tolower(R[i]);
+ if (s_c != find[i])
+ goto next_start;
+ }
+ return R;
+ next_start:;
+ }
+ return NULL;
+}
+
+
strncmp_fp get_strstr(enum case_behavior casing) {
strncmp_fp ag_strncmp_fp = &boyer_moore_strnstr;
@@ -474,7 +537,7 @@
int is_named_pipe(const char *path, const struct dirent *d) {
#ifdef HAVE_DIRENT_DTYPE
if (d->d_type != DT_UNKNOWN) {
- return d->d_type == DT_FIFO;
+ return d->d_type == DT_FIFO || d->d_type == DT_SOCK;
}
#endif
char *full_path;
@@ -485,7 +548,7 @@
return FALSE;
}
free(full_path);
- return S_ISFIFO(s.st_mode);
+ return S_ISFIFO(s.st_mode) || S_ISSOCK(s.st_mode);
}
void ag_asprintf(char **ret, const char *fmt, ...) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/src/util.h new/the_silver_searcher-1.0.2/src/util.h
--- old/the_silver_searcher-0.33.0/src/util.h 2016-06-23 20:33:43.000000000 +0200
+++ new/the_silver_searcher-1.0.2/src/util.h 2016-12-03 21:46:47.000000000 +0100
@@ -3,7 +3,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -22,6 +22,8 @@
#define FALSE 0
#endif
+#define H_SIZE (64 * 1024)
+
void *ag_malloc(size_t size);
void *ag_realloc(void *ptr, size_t size);
void *ag_calloc(size_t nelem, size_t elsize);
@@ -47,12 +49,19 @@
typedef const char *(*strncmp_fp)(const char *, const char *, const size_t, const size_t, const size_t[], const size_t *);
+/* Union to translate between chars and words without violating strict aliasing */
+typedef union {
+ char as_chars[sizeof(uint16_t)];
+ uint16_t as_word;
+} word_t;
+
void free_strings(char **strs, const size_t strs_len);
void generate_alpha_skip(const char *find, size_t f_len, size_t skip_lookup[], const int case_sensitive);
int is_prefix(const char *s, const size_t s_len, const size_t pos, const int case_sensitive);
size_t suffix_len(const char *s, const size_t s_len, const size_t pos, const int case_sensitive);
void generate_find_skip(const char *find, const size_t f_len, size_t **skip_lookup, const int case_sensitive);
+void generate_hash(const char *find, const size_t f_len, uint8_t *H, const int case_sensitive);
/* max is already defined on spec-violating compilers such as MinGW */
size_t ag_max(size_t a, size_t b);
@@ -61,6 +70,7 @@
const size_t alpha_skip_lookup[], const size_t *find_skip_lookup);
const char *boyer_moore_strncasestr(const char *s, const char *find, const size_t s_len, const size_t f_len,
const size_t alpha_skip_lookup[], const size_t *find_skip_lookup);
+const char *hash_strnstr(const char *s, const char *find, const size_t s_len, const size_t f_len, uint8_t *h_table, const int case_sensitive);
strncmp_fp get_strstr(enum case_behavior opts);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/the_silver_searcher-0.33.0/the_silver_searcher.spec new/the_silver_searcher-1.0.2/the_silver_searcher.spec
--- old/the_silver_searcher-0.33.0/the_silver_searcher.spec 2016-09-25 02:22:49.000000000 +0200
+++ new/the_silver_searcher-1.0.2/the_silver_searcher.spec 2016-12-03 23:42:31.000000000 +0100
@@ -2,7 +2,7 @@
Name: the_silver_searcher
-Version: 0.33.0
+Version: 1.0.2
Release: 1%{?dist}
Summary: A code-searching tool similar to ack, but faster