update to 2.2.0
This commit is contained in:
parent
1d75ed0894
commit
7d9724448e
51
0001-update-zsh-completion-for-new-options.patch
Normal file
51
0001-update-zsh-completion-for-new-options.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From f54d783700757b6f988418995befaf233db6da40 Mon Sep 17 00:00:00 2001
|
||||
From: Oliver Kiddle <opk@zsh.org>
|
||||
Date: Tue, 29 Aug 2017 01:44:43 +0200
|
||||
Subject: [PATCH 1/2] update zsh completion for new options
|
||||
|
||||
---
|
||||
_the_silver_searcher | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/_the_silver_searcher b/_the_silver_searcher
|
||||
index 60d2a75..650d53c 100644
|
||||
--- a/_the_silver_searcher
|
||||
+++ b/_the_silver_searcher
|
||||
@@ -5,7 +5,7 @@
|
||||
local ret=1
|
||||
local -a args expl
|
||||
|
||||
-# Intentionally avoided many possible mutual exlusions because it is
|
||||
+# Intentionally avoided many possible mutual exclusions 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+=(
|
||||
@@ -39,7 +39,7 @@ while _tags; do
|
||||
'(-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' \
|
||||
+ '(1 -G --file-search-regex -g --filename-pattern)'{--filename-pattern=,-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]' \
|
||||
@@ -48,6 +48,7 @@ while _tags; do
|
||||
'(-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]" \
|
||||
+ "--print-all-files[print headings for all files searched, even those that don't contain matches]" \
|
||||
'(--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]' \
|
||||
@@ -59,7 +60,7 @@ while _tags; do
|
||||
'--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)]' \
|
||||
+ '(-U --skip-vcs-ignores)'{-U,--skip-vcs-ignores}'[ignore VCS files (still 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]' \
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
From 2deb5b23b1f97e5e554838e0c31d634542e94b40 Mon Sep 17 00:00:00 2001
|
||||
From: Carl George <carl@george.computer>
|
||||
Date: Tue, 29 Sep 2020 13:13:04 -0500
|
||||
Subject: [PATCH 2/2] Install shell completion files to correct locations
|
||||
|
||||
Bash completion files should be installed to
|
||||
/usr/share/bash-completion/completions, with a file name matching the
|
||||
command name. Zsh completion files should be installed to
|
||||
/usr/share/zsh/site-functions, with a file name matching the command
|
||||
name prefixed with an underscore.
|
||||
|
||||
Resolves #271
|
||||
|
||||
https://github.com/scop/bash-completion/blob/master/README.md#faq
|
||||
http://zsh.sourceforge.net/Doc/Release/Completion-System.html
|
||||
---
|
||||
Makefile.am | 6 +++---
|
||||
ag.bashcomp.sh => completions/bash/ag | 0
|
||||
_the_silver_searcher => completions/zsh/_ag | 0
|
||||
the_silver_searcher.spec.in | 11 +++--------
|
||||
4 files changed, 6 insertions(+), 11 deletions(-)
|
||||
rename ag.bashcomp.sh => completions/bash/ag (100%)
|
||||
rename _the_silver_searcher => completions/zsh/_ag (100%)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 3931c3a..280b169 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -6,10 +6,10 @@ ag_LDADD = ${PCRE_LIBS} ${LZMA_LIBS} ${ZLIB_LIBS} $(PTHREAD_LIBS)
|
||||
|
||||
dist_man_MANS = doc/ag.1
|
||||
|
||||
-bashcompdir = $(pkgdatadir)/completions
|
||||
-dist_bashcomp_DATA = ag.bashcomp.sh
|
||||
+bashcompdir = $(datadir)/bash-completion/completions
|
||||
+dist_bashcomp_DATA = completions/bash/ag
|
||||
zshcompdir = $(datadir)/zsh/site-functions
|
||||
-dist_zshcomp_DATA = _the_silver_searcher
|
||||
+dist_zshcomp_DATA = completions/zsh/_ag
|
||||
|
||||
EXTRA_DIST = Makefile.w32 LICENSE NOTICE the_silver_searcher.spec README.md
|
||||
|
||||
diff --git a/ag.bashcomp.sh b/completions/bash/ag
|
||||
similarity index 100%
|
||||
rename from ag.bashcomp.sh
|
||||
rename to completions/bash/ag
|
||||
diff --git a/_the_silver_searcher b/completions/zsh/_ag
|
||||
similarity index 100%
|
||||
rename from _the_silver_searcher
|
||||
rename to completions/zsh/_ag
|
||||
diff --git a/the_silver_searcher.spec.in b/the_silver_searcher.spec.in
|
||||
index 445bdec..9239179 100644
|
||||
--- a/the_silver_searcher.spec.in
|
||||
+++ b/the_silver_searcher.spec.in
|
||||
@@ -1,6 +1,3 @@
|
||||
-%define _bashcompdir %_sysconfdir/bash_completion.d
|
||||
-%define _zshcompdir %{_datadir}/zsh/site-functions
|
||||
-
|
||||
Name: the_silver_searcher
|
||||
Version: @VERSION@
|
||||
Release: 1%{?dist}
|
||||
@@ -49,8 +46,6 @@ make %{?_smp_mflags}
|
||||
%install
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
-mkdir -p ${RPM_BUILD_ROOT}%{_bashcompdir}
|
||||
-install -m 644 ag.bashcomp.sh ${RPM_BUILD_ROOT}%{_bashcompdir}
|
||||
|
||||
%clean
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
@@ -60,9 +55,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/*
|
||||
%{_mandir}/*
|
||||
-%config %{_bashcompdir}/ag.bashcomp.sh
|
||||
-%config %{_datadir}/%{name}/completions/ag.bashcomp.sh
|
||||
-%config %{_datadir}/zsh/site-functions/_the_silver_searcher
|
||||
+%{_datadir}/bash-completion/completions/ag
|
||||
+%{_datadir}/zsh/site-functions/_ag
|
||||
+
|
||||
|
||||
%changelog
|
||||
* Thu Dec 5 2013 Emily Strickland <code@emily.st> - 0.18.1-1
|
||||
--
|
||||
2.31.1
|
||||
|
||||
Binary file not shown.
876
5a1c8d83ba.patch
Normal file
876
5a1c8d83ba.patch
Normal file
@ -0,0 +1,876 @@
|
||||
diff -Nur a/ag.bashcomp.sh b/ag.bashcomp.sh
|
||||
--- a/ag.bashcomp.sh 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/ag.bashcomp.sh 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -67,7 +67,7 @@
|
||||
--parallel
|
||||
--passthrough
|
||||
--passthru
|
||||
- --path-to-agignore
|
||||
+ --path-to-ignore
|
||||
--print-long-lines
|
||||
--print0
|
||||
--recurse
|
||||
@@ -106,7 +106,7 @@
|
||||
--ignore-dir) # directory completion
|
||||
_filedir -d
|
||||
return 0;;
|
||||
- --path-to-agignore) # file completion
|
||||
+ --path-to-ignore) # file completion
|
||||
_filedir
|
||||
return 0;;
|
||||
--pager) # command completion
|
||||
diff -Nur a/README.md b/README.md
|
||||
--- a/README.md 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/README.md 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -76,14 +76,18 @@
|
||||
|
||||
sbopkg -i the_silver_searcher
|
||||
|
||||
-* openSUSE:
|
||||
+* openSUSE
|
||||
|
||||
zypper install the_silver_searcher
|
||||
|
||||
-* CentOS:
|
||||
-
|
||||
+* CentOS
|
||||
+
|
||||
yum install the_silver_searcher
|
||||
|
||||
+* NixOS/Nix/Nixpkgs
|
||||
+
|
||||
+ nix-env -iA silver-searcher
|
||||
+
|
||||
* SUSE Linux Enterprise: Follow [these simple instructions](https://software.opensuse.org/download.html?project=utilities&package=the_silver_searcher).
|
||||
|
||||
|
||||
@@ -102,6 +106,20 @@
|
||||
|
||||
Unofficial daily builds are [available](https://github.com/k-takata/the_silver_searcher-win32).
|
||||
|
||||
+* winget
|
||||
+
|
||||
+ winget install "The Silver Searcher"
|
||||
+
|
||||
+ Notes:
|
||||
+ - This installs a [release](https://github.com/JFLarvoire/the_silver_searcher/releases) of ag.exe optimized for Windows.
|
||||
+ - winget is intended to become the default package manager client for Windows.
|
||||
+ As of June 2020, it's still in beta, and can be installed using instructions [there](https://github.com/microsoft/winget-cli).
|
||||
+ - The setup script in the Ag's winget package installs ag.exe in the first directory that matches one of these criteria:
|
||||
+ 1. Over a previous instance of ag.exe *from the same [origin](https://github.com/JFLarvoire/the_silver_searcher)* found in the PATH
|
||||
+ 2. In the directory defined in environment variable bindir_%PROCESSOR_ARCHITECTURE%
|
||||
+ 3. In the directory defined in environment variable bindir
|
||||
+ 4. In the directory defined in environment variable windir
|
||||
+
|
||||
* Chocolatey
|
||||
|
||||
choco install ag
|
||||
@@ -132,7 +150,7 @@
|
||||
* CentOS:
|
||||
|
||||
yum -y groupinstall "Development Tools"
|
||||
- yum -y install pcre-devel xz-devel
|
||||
+ yum -y install pcre-devel xz-devel zlib-devel
|
||||
* openSUSE:
|
||||
|
||||
zypper source-install --build-deps-only the_silver_searcher
|
||||
@@ -190,9 +208,10 @@
|
||||
|
||||
## Other stuff you might like
|
||||
|
||||
-* [Ack](https://github.com/petdance/ack2) - Better than grep. Without Ack, Ag would not exist.
|
||||
+* [Ack](https://github.com/petdance/ack3) - Better than grep. Without Ack, Ag would not exist.
|
||||
* [ack.vim](https://github.com/mileszs/ack.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.
|
||||
+* [fzf](https://github.com/junegunn/fzf) - A command-line fuzzy finder
|
||||
* [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 -Nur a/src/ignore.c b/src/ignore.c
|
||||
--- a/src/ignore.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/ignore.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -20,6 +20,8 @@
|
||||
const int fnmatch_flags = FNM_PATHNAME;
|
||||
#endif
|
||||
|
||||
+ignores *root_ignores;
|
||||
+
|
||||
/* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */
|
||||
|
||||
const char *evil_hardcoded_ignore_files[] = {
|
||||
@@ -206,6 +208,7 @@
|
||||
/* This is the hottest code in Ag. 10-15% of all execution time is spent here */
|
||||
static int path_ignore_search(const ignores *ig, const char *path, const char *filename) {
|
||||
char *temp;
|
||||
+ int temp_start_pos;
|
||||
size_t i;
|
||||
int match_pos;
|
||||
|
||||
@@ -216,9 +219,12 @@
|
||||
}
|
||||
|
||||
ag_asprintf(&temp, "%s/%s", path[0] == '.' ? path + 1 : path, filename);
|
||||
+ //ig->abs_path has its leading slash stripped, so we have to strip the leading slash
|
||||
+ //of temp as well
|
||||
+ temp_start_pos = (temp[0] == '/') ? 1 : 0;
|
||||
|
||||
- if (strncmp(temp, ig->abs_path, ig->abs_path_len) == 0) {
|
||||
- char *slash_filename = temp + ig->abs_path_len;
|
||||
+ if (strncmp(temp + temp_start_pos, ig->abs_path, ig->abs_path_len) == 0) {
|
||||
+ char *slash_filename = temp + temp_start_pos + ig->abs_path_len;
|
||||
if (slash_filename[0] == '/') {
|
||||
slash_filename++;
|
||||
}
|
||||
diff -Nur a/src/ignore.h b/src/ignore.h
|
||||
--- a/src/ignore.h 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/ignore.h 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -29,7 +29,7 @@
|
||||
};
|
||||
typedef struct ignores ignores;
|
||||
|
||||
-ignores *root_ignores;
|
||||
+extern ignores *root_ignores;
|
||||
|
||||
extern const char *evil_hardcoded_ignore_files[];
|
||||
extern const char *ignore_pattern_files[];
|
||||
diff -Nur a/src/lang.c b/src/lang.c
|
||||
--- a/src/lang.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/lang.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -10,18 +10,22 @@
|
||||
{ "asciidoc", { "adoc", "ad", "asc", "asciidoc" } },
|
||||
{ "apl", { "apl" } },
|
||||
{ "asm", { "asm", "s" } },
|
||||
+ { "asp", { "asp", "asa", "aspx", "asax", "ashx", "ascx", "asmx" } },
|
||||
+ { "aspx", { "asp", "asa", "aspx", "asax", "ashx", "ascx", "asmx" } },
|
||||
{ "batch", { "bat", "cmd" } },
|
||||
+ { "bazel", { "bazel" } },
|
||||
{ "bitbake", { "bb", "bbappend", "bbclass", "inc" } },
|
||||
- { "bro", { "bro", "bif" } },
|
||||
{ "cc", { "c", "h", "xs" } },
|
||||
{ "cfmx", { "cfc", "cfm", "cfml" } },
|
||||
{ "chpl", { "chpl" } },
|
||||
- { "clojure", { "clj", "cljs", "cljc", "cljx" } },
|
||||
+ { "clojure", { "clj", "cljs", "cljc", "cljx", "edn" } },
|
||||
{ "coffee", { "coffee", "cjsx" } },
|
||||
+ { "config", { "config" } },
|
||||
{ "coq", { "coq", "g", "v" } },
|
||||
{ "cpp", { "cpp", "cc", "C", "cxx", "m", "hpp", "hh", "h", "H", "hxx", "tpp" } },
|
||||
{ "crystal", { "cr", "ecr" } },
|
||||
{ "csharp", { "cs" } },
|
||||
+ { "cshtml", { "cshtml" } },
|
||||
{ "css", { "css" } },
|
||||
{ "cython", { "pyx", "pxd", "pxi" } },
|
||||
{ "delphi", { "pas", "int", "dfm", "nfm", "dof", "dpk", "dpr", "dproj", "groupproj", "bdsgroup", "bdsproj" } },
|
||||
@@ -34,11 +38,12 @@
|
||||
{ "elm", { "elm" } },
|
||||
{ "erlang", { "erl", "hrl" } },
|
||||
{ "factor", { "factor" } },
|
||||
- { "fortran", { "f", "f77", "f90", "f95", "f03", "for", "ftn", "fpp" } },
|
||||
+ { "fortran", { "f", "F", "f77", "f90", "F90", "f95", "f03", "for", "ftn", "fpp", "FPP" } },
|
||||
{ "fsharp", { "fs", "fsi", "fsx" } },
|
||||
{ "gettext", { "po", "pot", "mo" } },
|
||||
{ "glsl", { "vert", "tesc", "tese", "geom", "frag", "comp" } },
|
||||
{ "go", { "go" } },
|
||||
+ { "gradle", { "gradle" } },
|
||||
{ "groovy", { "groovy", "gtmpl", "gpp", "grunit", "gradle" } },
|
||||
{ "haml", { "haml" } },
|
||||
{ "handlebars", { "hbs" } },
|
||||
@@ -88,13 +93,16 @@
|
||||
{ "pike", { "pike", "pmod" } },
|
||||
{ "plist", { "plist" } },
|
||||
{ "plone", { "pt", "cpt", "metadata", "cpy", "py", "xml", "zcml" } },
|
||||
+ { "powershell", { "ps1" } },
|
||||
{ "proto", { "proto" } },
|
||||
+ { "ps1", { "ps1" } },
|
||||
{ "pug", { "pug" } },
|
||||
{ "puppet", { "pp" } },
|
||||
{ "python", { "py" } },
|
||||
{ "qml", { "qml" } },
|
||||
{ "racket", { "rkt", "ss", "scm" } },
|
||||
{ "rake", { "Rakefile" } },
|
||||
+ { "razor", { "cshtml" } },
|
||||
{ "restructuredtext", { "rst" } },
|
||||
{ "rs", { "rs" } },
|
||||
{ "r", { "r", "R", "Rmd", "Rnw", "Rtex", "Rrst" } },
|
||||
@@ -124,14 +132,17 @@
|
||||
{ "vala", { "vala", "vapi" } },
|
||||
{ "vb", { "bas", "cls", "frm", "ctl", "vb", "resx" } },
|
||||
{ "velocity", { "vm", "vtl", "vsl" } },
|
||||
- { "verilog", { "v", "vh", "sv" } },
|
||||
+ { "verilog", { "v", "vh", "sv", "svh" } },
|
||||
{ "vhdl", { "vhd", "vhdl" } },
|
||||
{ "vim", { "vim" } },
|
||||
+ { "vue", { "vue" } },
|
||||
{ "wix", { "wxi", "wxs" } },
|
||||
{ "wsdl", { "wsdl" } },
|
||||
{ "wadl", { "wadl" } },
|
||||
- { "xml", { "xml", "dtd", "xsl", "xslt", "ent", "tld", "plist" } },
|
||||
- { "yaml", { "yaml", "yml" } }
|
||||
+ { "xml", { "xml", "dtd", "xsl", "xslt", "xsd", "ent", "tld", "plist", "wsdl" } },
|
||||
+ { "yaml", { "yaml", "yml" } },
|
||||
+ { "zeek", { "zeek", "bro", "bif" } },
|
||||
+ { "zephir", { "zep" } }
|
||||
};
|
||||
|
||||
size_t get_lang_count() {
|
||||
diff -Nur a/src/log.c b/src/log.c
|
||||
--- a/src/log.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/log.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
+pthread_mutex_t print_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
static enum log_level log_threshold = LOG_LEVEL_ERR;
|
||||
|
||||
void set_log_level(enum log_level threshold) {
|
||||
diff -Nur a/src/log.h b/src/log.h
|
||||
--- a/src/log.h 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/log.h 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
-pthread_mutex_t print_mtx;
|
||||
+extern pthread_mutex_t print_mtx;
|
||||
|
||||
enum log_level {
|
||||
LOG_LEVEL_DEBUG = 10,
|
||||
diff -Nur a/src/main.c b/src/main.c
|
||||
--- a/src/main.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/main.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -154,7 +154,7 @@
|
||||
}
|
||||
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && (defined(USE_CPU_SET) || defined(HAVE_SYS_CPUSET_H))
|
||||
if (opts.use_thread_affinity) {
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__midipix__)
|
||||
cpu_set_t cpu_set;
|
||||
#elif __FreeBSD__
|
||||
cpuset_t cpu_set;
|
||||
diff -Nur a/src/options.c b/src/options.c
|
||||
--- a/src/options.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/options.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -20,6 +20,8 @@
|
||||
const char *color_match = "\033[30;43m"; /* black with yellow background */
|
||||
const char *color_path = "\033[1;32m"; /* bold green */
|
||||
|
||||
+cli_options opts;
|
||||
+
|
||||
/* TODO: try to obey out_fd? */
|
||||
void usage(void) {
|
||||
printf("\n");
|
||||
@@ -143,9 +145,14 @@
|
||||
}
|
||||
|
||||
void init_options(void) {
|
||||
+ char *term = getenv("TERM");
|
||||
+
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.casing = CASE_DEFAULT;
|
||||
opts.color = TRUE;
|
||||
+ if (term && !strcmp(term, "dumb")) {
|
||||
+ opts.color = FALSE;
|
||||
+ }
|
||||
opts.color_win_ansi = FALSE;
|
||||
opts.max_matches_per_file = 0;
|
||||
opts.max_search_depth = DEFAULT_MAX_SEARCH_DEPTH;
|
||||
@@ -446,8 +453,9 @@
|
||||
opts.casing = CASE_INSENSITIVE;
|
||||
break;
|
||||
case 'L':
|
||||
- opts.invert_match = 1;
|
||||
- /* fall through */
|
||||
+ opts.print_nonmatching_files = 1;
|
||||
+ opts.print_path = PATH_PRINT_TOP;
|
||||
+ break;
|
||||
case 'l':
|
||||
needs_query = 0;
|
||||
opts.print_filename_only = 1;
|
||||
@@ -705,8 +713,10 @@
|
||||
const char *config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (config_home) {
|
||||
ag_asprintf(&gitconfig_res, "%s/%s", config_home, "git/ignore");
|
||||
- } else {
|
||||
+ } else if (home_dir) {
|
||||
ag_asprintf(&gitconfig_res, "%s/%s", home_dir, ".config/git/ignore");
|
||||
+ } else {
|
||||
+ gitconfig_res = ag_strdup("");
|
||||
}
|
||||
}
|
||||
log_debug("global core.excludesfile: %s", gitconfig_res);
|
||||
diff -Nur a/src/options.h b/src/options.h
|
||||
--- a/src/options.h 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/options.h 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -60,6 +60,7 @@
|
||||
int print_break;
|
||||
int print_count;
|
||||
int print_filename_only;
|
||||
+ int print_nonmatching_files;
|
||||
int print_path;
|
||||
int print_all_paths;
|
||||
int print_line_numbers;
|
||||
@@ -91,7 +92,7 @@
|
||||
} cli_options;
|
||||
|
||||
/* global options. parse_options gives it sane values, everything else reads from it */
|
||||
-cli_options opts;
|
||||
+extern cli_options opts;
|
||||
|
||||
typedef struct option option_t;
|
||||
|
||||
diff -Nur a/src/search.c b/src/search.c
|
||||
--- a/src/search.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/search.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -2,8 +2,22 @@
|
||||
#include "print.h"
|
||||
#include "scandir.h"
|
||||
|
||||
-void search_buf(const char *buf, const size_t buf_len,
|
||||
- const char *dir_full_path) {
|
||||
+size_t alpha_skip_lookup[256];
|
||||
+size_t *find_skip_lookup;
|
||||
+uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+
|
||||
+work_queue_t *work_queue = NULL;
|
||||
+work_queue_t *work_queue_tail = NULL;
|
||||
+int done_adding_files = 0;
|
||||
+pthread_cond_t files_ready = PTHREAD_COND_INITIALIZER;
|
||||
+pthread_mutex_t stats_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+pthread_mutex_t work_queue_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+symdir_t *symhash = NULL;
|
||||
+
|
||||
+/* Returns: -1 if skipped, otherwise # of matches */
|
||||
+ssize_t search_buf(const char *buf, const size_t buf_len,
|
||||
+ const char *dir_full_path) {
|
||||
int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */
|
||||
size_t buf_offset = 0;
|
||||
|
||||
@@ -13,7 +27,7 @@
|
||||
binary = is_binary((const void *)buf, buf_len);
|
||||
if (binary) {
|
||||
log_debug("File %s is binary. Skipping...", dir_full_path);
|
||||
- return;
|
||||
+ return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,25 +188,16 @@
|
||||
pthread_mutex_unlock(&stats_mtx);
|
||||
}
|
||||
|
||||
- if (matches_len > 0 || opts.print_all_paths) {
|
||||
+ if (!opts.print_nonmatching_files && (matches_len > 0 || opts.print_all_paths)) {
|
||||
if (binary == -1 && !opts.print_filename_only) {
|
||||
binary = is_binary((const void *)buf, buf_len);
|
||||
}
|
||||
pthread_mutex_lock(&print_mtx);
|
||||
if (opts.print_filename_only) {
|
||||
- /* If the --files-without-matches or -L option is passed we should
|
||||
- * not print a matching line. This option currently sets
|
||||
- * opts.print_filename_only and opts.invert_match. Unfortunately
|
||||
- * setting the latter has the side effect of making matches.len = 1
|
||||
- * on a file-without-matches which is not desired behaviour. See
|
||||
- * GitHub issue 206 for the consequences if this behaviour is not
|
||||
- * checked. */
|
||||
- if (!opts.invert_match || matches_len < 2) {
|
||||
- if (opts.print_count) {
|
||||
- print_path_count(dir_full_path, opts.path_sep, (size_t)matches_len);
|
||||
- } else {
|
||||
- print_path(dir_full_path, opts.path_sep);
|
||||
- }
|
||||
+ if (opts.print_count) {
|
||||
+ print_path_count(dir_full_path, opts.path_sep, (size_t)matches_len);
|
||||
+ } else {
|
||||
+ print_path(dir_full_path, opts.path_sep);
|
||||
}
|
||||
} else if (binary) {
|
||||
print_binary_file_matches(dir_full_path);
|
||||
@@ -214,11 +219,16 @@
|
||||
if (matches_size > 0) {
|
||||
free(matches);
|
||||
}
|
||||
+
|
||||
+ /* FIXME: handle case where matches_len > SSIZE_MAX */
|
||||
+ return (ssize_t)matches_len;
|
||||
}
|
||||
|
||||
+/* Return value: -1 if skipped, otherwise # of matches */
|
||||
/* TODO: this will only match single lines. multi-line regexes silently don't match */
|
||||
-void search_stream(FILE *stream, const char *path) {
|
||||
+ssize_t search_stream(FILE *stream, const char *path) {
|
||||
char *line = NULL;
|
||||
+ ssize_t matches_count = 0;
|
||||
ssize_t line_len = 0;
|
||||
size_t line_cap = 0;
|
||||
size_t i;
|
||||
@@ -226,8 +236,17 @@
|
||||
print_init_context();
|
||||
|
||||
for (i = 1; (line_len = getline(&line, &line_cap, stream)) > 0; i++) {
|
||||
+ ssize_t result;
|
||||
opts.stream_line_num = i;
|
||||
- search_buf(line, line_len, path);
|
||||
+ result = search_buf(line, line_len, path);
|
||||
+ if (result > 0) {
|
||||
+ if (matches_count == -1) {
|
||||
+ matches_count = 0;
|
||||
+ }
|
||||
+ matches_count += result;
|
||||
+ } else if (matches_count <= 0 && result == -1) {
|
||||
+ matches_count = -1;
|
||||
+ }
|
||||
if (line[line_len - 1] == '\n') {
|
||||
line_len--;
|
||||
}
|
||||
@@ -236,6 +255,7 @@
|
||||
|
||||
free(line);
|
||||
print_cleanup_context();
|
||||
+ return matches_count;
|
||||
}
|
||||
|
||||
void search_file(const char *file_full_path) {
|
||||
@@ -244,6 +264,7 @@
|
||||
char *buf = NULL;
|
||||
struct stat statbuf;
|
||||
int rv = 0;
|
||||
+ int matches_count = -1;
|
||||
FILE *fp = NULL;
|
||||
|
||||
rv = stat(file_full_path, &statbuf);
|
||||
@@ -293,7 +314,7 @@
|
||||
if (statbuf.st_mode & S_IFIFO) {
|
||||
log_debug("%s is a named pipe. stream searching", file_full_path);
|
||||
fp = fdopen(fd, "r");
|
||||
- search_stream(fp, file_full_path);
|
||||
+ matches_count = search_stream(fp, file_full_path);
|
||||
fclose(fp);
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -302,7 +323,7 @@
|
||||
|
||||
if (f_len == 0) {
|
||||
if (opts.query[0] == '.' && opts.query_len == 1 && !opts.literal && opts.search_all_files) {
|
||||
- search_buf(buf, f_len, file_full_path);
|
||||
+ matches_count = search_buf(buf, f_len, file_full_path);
|
||||
} else {
|
||||
log_debug("Skipping %s: file is empty.", file_full_path);
|
||||
}
|
||||
@@ -374,7 +395,7 @@
|
||||
#if HAVE_FOPENCOOKIE
|
||||
log_debug("%s is a compressed file. stream searching", file_full_path);
|
||||
fp = decompress_open(fd, "r", zip_type);
|
||||
- search_stream(fp, file_full_path);
|
||||
+ matches_count = search_stream(fp, file_full_path);
|
||||
fclose(fp);
|
||||
#else
|
||||
int _buf_len = (int)f_len;
|
||||
@@ -383,17 +404,24 @@
|
||||
log_err("Cannot decompress zipped file %s", file_full_path);
|
||||
goto cleanup;
|
||||
}
|
||||
- search_buf(_buf, _buf_len, file_full_path);
|
||||
+ matches_count = search_buf(_buf, _buf_len, file_full_path);
|
||||
free(_buf);
|
||||
#endif
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
- search_buf(buf, f_len, file_full_path);
|
||||
+ matches_count = search_buf(buf, f_len, file_full_path);
|
||||
|
||||
cleanup:
|
||||
|
||||
+ if (opts.print_nonmatching_files && matches_count == 0) {
|
||||
+ pthread_mutex_lock(&print_mtx);
|
||||
+ print_path(file_full_path, opts.path_sep);
|
||||
+ pthread_mutex_unlock(&print_mtx);
|
||||
+ opts.match_found = 1;
|
||||
+ }
|
||||
+
|
||||
print_cleanup_context();
|
||||
if (buf != NULL) {
|
||||
#ifdef _WIN32
|
||||
diff -Nur a/src/search.h b/src/search.h
|
||||
--- a/src/search.h 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/search.h 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -31,9 +31,9 @@
|
||||
#include "uthash.h"
|
||||
#include "util.h"
|
||||
|
||||
-size_t alpha_skip_lookup[256];
|
||||
-size_t *find_skip_lookup;
|
||||
-uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+extern size_t alpha_skip_lookup[256];
|
||||
+extern size_t *find_skip_lookup;
|
||||
+extern uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
|
||||
struct work_queue_t {
|
||||
char *path;
|
||||
@@ -41,12 +41,12 @@
|
||||
};
|
||||
typedef struct work_queue_t work_queue_t;
|
||||
|
||||
-work_queue_t *work_queue;
|
||||
-work_queue_t *work_queue_tail;
|
||||
-int done_adding_files;
|
||||
-pthread_cond_t files_ready;
|
||||
-pthread_mutex_t stats_mtx;
|
||||
-pthread_mutex_t work_queue_mtx;
|
||||
+extern work_queue_t *work_queue;
|
||||
+extern work_queue_t *work_queue_tail;
|
||||
+extern int done_adding_files;
|
||||
+extern pthread_cond_t files_ready;
|
||||
+extern pthread_mutex_t stats_mtx;
|
||||
+extern pthread_mutex_t work_queue_mtx;
|
||||
|
||||
|
||||
/* For symlink loop detection */
|
||||
@@ -64,11 +64,11 @@
|
||||
UT_hash_handle hh;
|
||||
} symdir_t;
|
||||
|
||||
-symdir_t *symhash;
|
||||
+extern symdir_t *symhash;
|
||||
|
||||
-void search_buf(const char *buf, const size_t buf_len,
|
||||
- const char *dir_full_path);
|
||||
-void search_stream(FILE *stream, const char *path);
|
||||
+ssize_t search_buf(const char *buf, const size_t buf_len,
|
||||
+ const char *dir_full_path);
|
||||
+ssize_t search_stream(FILE *stream, const char *path);
|
||||
void search_file(const char *file_full_path);
|
||||
|
||||
void *search_file_worker(void *i);
|
||||
diff -Nur a/src/util.c b/src/util.c
|
||||
--- a/src/util.c 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/util.c 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -21,6 +21,8 @@
|
||||
} \
|
||||
return ptr;
|
||||
|
||||
+FILE *out_fd = NULL;
|
||||
+ag_stats stats;
|
||||
void *ag_malloc(size_t size) {
|
||||
void *ptr = malloc(size);
|
||||
CHECK_AND_RETURN(ptr)
|
||||
@@ -516,7 +518,7 @@
|
||||
|
||||
int is_named_pipe(const char *path, const struct dirent *d) {
|
||||
#ifdef HAVE_DIRENT_DTYPE
|
||||
- if (d->d_type != DT_UNKNOWN) {
|
||||
+ if (d->d_type != DT_UNKNOWN && d->d_type != DT_LNK) {
|
||||
return d->d_type == DT_FIFO || d->d_type == DT_SOCK;
|
||||
}
|
||||
#endif
|
||||
diff -Nur a/src/util.h b/src/util.h
|
||||
--- a/src/util.h 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/src/util.h 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "options.h"
|
||||
|
||||
-FILE *out_fd;
|
||||
+extern FILE *out_fd;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
@@ -51,7 +51,7 @@
|
||||
} ag_stats;
|
||||
|
||||
|
||||
-ag_stats stats;
|
||||
+extern ag_stats stats;
|
||||
|
||||
/* Union to translate between chars and words without violating strict aliasing */
|
||||
typedef union {
|
||||
diff -Nur a/tests/empty_environment.t b/tests/empty_environment.t
|
||||
--- a/tests/empty_environment.t 1970-01-01 08:00:00.000000000 +0800
|
||||
+++ b/tests/empty_environment.t 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -0,0 +1,9 @@
|
||||
+Setup:
|
||||
+
|
||||
+ $ . $TESTDIR/setup.sh
|
||||
+ $ printf "hello world\n" >test.txt
|
||||
+
|
||||
+Verify ag runs with an empty environment:
|
||||
+
|
||||
+ $ env -i $TESTDIR/../ag --noaffinity --nocolor --workers=1 --parallel hello
|
||||
+ test.txt:1:hello world
|
||||
diff -Nur a/tests/files_with_matches.t b/tests/files_with_matches.t
|
||||
--- a/tests/files_with_matches.t 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/tests/files_with_matches.t 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -3,6 +3,10 @@
|
||||
$ . $TESTDIR/setup.sh
|
||||
$ printf 'foo\n' > ./foo.txt
|
||||
$ printf 'bar\n' > ./bar.txt
|
||||
+ $ printf 'foo\nbar\nbaz\n' > ./baz.txt
|
||||
+ $ printf 'duck\nanother duck\nyet another duck\n' > ./duck.txt
|
||||
+ $ cp duck.txt goose.txt
|
||||
+ $ echo "GOOSE!!!" >> ./goose.txt
|
||||
|
||||
Files with matches:
|
||||
|
||||
@@ -12,8 +16,17 @@
|
||||
foo.txt
|
||||
$ ag --files-with-matches foo bar.txt
|
||||
[1]
|
||||
+ $ ag --files-with-matches foo foo.txt bar.txt baz.txt
|
||||
+ foo.txt
|
||||
+ baz.txt
|
||||
+ $ ag --files-with-matches bar foo.txt bar.txt baz.txt
|
||||
+ bar.txt
|
||||
+ baz.txt
|
||||
+ $ ag --files-with-matches foo bar.txt baz.txt
|
||||
+ baz.txt
|
||||
|
||||
Files without matches:
|
||||
+(Prints names of files in which no line matches query)
|
||||
|
||||
$ ag --files-without-matches bar foo.txt
|
||||
foo.txt
|
||||
@@ -21,3 +34,30 @@
|
||||
foo.txt
|
||||
$ ag --files-without-matches bar bar.txt
|
||||
[1]
|
||||
+ $ ag --files-without-matches foo foo.txt bar.txt baz.txt
|
||||
+ bar.txt
|
||||
+ $ ag --files-without-matches bar foo.txt bar.txt baz.txt
|
||||
+ foo.txt
|
||||
+
|
||||
+Files with inverted matches:
|
||||
+(Prints names of files in which some line doesn't match query)
|
||||
+
|
||||
+ $ ag --files-with-matches --invert-match bar bar.txt
|
||||
+ [1]
|
||||
+ $ ag --files-with-matches --invert-match foo foo.txt bar.txt baz.txt
|
||||
+ bar.txt
|
||||
+ baz.txt
|
||||
+ $ ag --files-with-matches --invert-match bar foo.txt bar.txt baz.txt
|
||||
+ foo.txt
|
||||
+ baz.txt
|
||||
+
|
||||
+Files without inverted matches:
|
||||
+(Prints names of files in which no line doesn't match query,
|
||||
+ i.e. where every line matches query)
|
||||
+
|
||||
+ $ ag --files-without-matches --invert-match duck duck.txt
|
||||
+ duck.txt
|
||||
+ $ ag --files-without-matches --invert-match duck goose.txt
|
||||
+ [1]
|
||||
+ $ ag --files-without-matches --invert-match duck duck.txt goose.txt
|
||||
+ duck.txt
|
||||
diff -Nur a/tests/ignore_slash_in_subdir.t b/tests/ignore_slash_in_subdir.t
|
||||
--- a/tests/ignore_slash_in_subdir.t 1970-01-01 08:00:00.000000000 +0800
|
||||
+++ b/tests/ignore_slash_in_subdir.t 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -0,0 +1,19 @@
|
||||
+Setup:
|
||||
+
|
||||
+ $ . $TESTDIR/setup.sh
|
||||
+ $ mkdir -p subdir/ignoredir
|
||||
+ $ mkdir ignoredir
|
||||
+ $ printf 'match1\n' > subdir/ignoredir/file1.txt
|
||||
+ $ printf 'match1\n' > ignoredir/file1.txt
|
||||
+ $ printf '/ignoredir\n' > subdir/.ignore
|
||||
+
|
||||
+Ignore file in subdir/ignoredir, but not in ignoredir:
|
||||
+
|
||||
+ $ ag match
|
||||
+ ignoredir/file1.txt:1:match1
|
||||
+
|
||||
+From subdir, ignore file in subdir/ignoredir:
|
||||
+
|
||||
+ $ cd subdir
|
||||
+ $ ag match
|
||||
+ [1]
|
||||
diff -Nur a/tests/list_file_types.t b/tests/list_file_types.t
|
||||
--- a/tests/list_file_types.t 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/tests/list_file_types.t 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -21,15 +21,21 @@
|
||||
--asm
|
||||
.asm .s
|
||||
|
||||
+ --asp
|
||||
+ .asp .asa .aspx .asax .ashx .ascx .asmx
|
||||
+
|
||||
+ --aspx
|
||||
+ .asp .asa .aspx .asax .ashx .ascx .asmx
|
||||
+
|
||||
--batch
|
||||
.bat .cmd
|
||||
|
||||
+ --bazel
|
||||
+ .bazel
|
||||
+
|
||||
--bitbake
|
||||
.bb .bbappend .bbclass .inc
|
||||
|
||||
- --bro
|
||||
- .bro .bif
|
||||
-
|
||||
--cc
|
||||
.c .h .xs
|
||||
|
||||
@@ -40,11 +46,14 @@
|
||||
.chpl
|
||||
|
||||
--clojure
|
||||
- .clj .cljs .cljc .cljx
|
||||
+ .clj .cljs .cljc .cljx .edn
|
||||
|
||||
--coffee
|
||||
.coffee .cjsx
|
||||
|
||||
+ --config
|
||||
+ .config
|
||||
+
|
||||
--coq
|
||||
.coq .g .v
|
||||
|
||||
@@ -57,6 +66,9 @@
|
||||
--csharp
|
||||
.cs
|
||||
|
||||
+ --cshtml
|
||||
+ .cshtml
|
||||
+
|
||||
--css
|
||||
.css
|
||||
|
||||
@@ -94,7 +106,7 @@
|
||||
.factor
|
||||
|
||||
--fortran
|
||||
- .f .f77 .f90 .f95 .f03 .for .ftn .fpp
|
||||
+ .f .F .f77 .f90 .F90 .f95 .f03 .for .ftn .fpp .FPP
|
||||
|
||||
--fsharp
|
||||
.fs .fsi .fsx
|
||||
@@ -108,6 +120,9 @@
|
||||
--go
|
||||
.go
|
||||
|
||||
+ --gradle
|
||||
+ .gradle
|
||||
+
|
||||
--groovy
|
||||
.groovy .gtmpl .gpp .grunit .gradle
|
||||
|
||||
@@ -255,9 +270,15 @@
|
||||
--plone
|
||||
.pt .cpt .metadata .cpy .py .xml .zcml
|
||||
|
||||
+ --powershell
|
||||
+ .ps1
|
||||
+
|
||||
--proto
|
||||
.proto
|
||||
|
||||
+ --ps1
|
||||
+ .ps1
|
||||
+
|
||||
--pug
|
||||
.pug
|
||||
|
||||
@@ -276,6 +297,9 @@
|
||||
--rake
|
||||
.Rakefile
|
||||
|
||||
+ --razor
|
||||
+ .cshtml
|
||||
+
|
||||
--restructuredtext
|
||||
.rst
|
||||
|
||||
@@ -364,7 +388,7 @@
|
||||
.vm .vtl .vsl
|
||||
|
||||
--verilog
|
||||
- .v .vh .sv
|
||||
+ .v .vh .sv .svh
|
||||
|
||||
--vhdl
|
||||
.vhd .vhdl
|
||||
@@ -372,6 +396,9 @@
|
||||
--vim
|
||||
.vim
|
||||
|
||||
+ --vue
|
||||
+ .vue
|
||||
+
|
||||
--wix
|
||||
.wxi .wxs
|
||||
|
||||
@@ -382,8 +409,14 @@
|
||||
.wadl
|
||||
|
||||
--xml
|
||||
- .xml .dtd .xsl .xslt .ent .tld .plist
|
||||
+ .xml .dtd .xsl .xslt .xsd .ent .tld .plist .wsdl
|
||||
|
||||
--yaml
|
||||
.yaml .yml
|
||||
|
||||
+ --zeek
|
||||
+ .zeek .bro .bif
|
||||
+
|
||||
+ --zephir
|
||||
+ .zep
|
||||
+
|
||||
\ No newline at end of file
|
||||
diff -Nur a/the_silver_searcher.spec.in b/the_silver_searcher.spec.in
|
||||
--- a/the_silver_searcher.spec.in 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/the_silver_searcher.spec.in 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -1,5 +1,5 @@
|
||||
%define _bashcompdir %_sysconfdir/bash_completion.d
|
||||
-
|
||||
+%define _zshcompdir %{_datadir}/zsh/site-functions
|
||||
|
||||
Name: the_silver_searcher
|
||||
Version: @VERSION@
|
||||
@@ -62,7 +62,7 @@
|
||||
%{_mandir}/*
|
||||
%config %{_bashcompdir}/ag.bashcomp.sh
|
||||
%config %{_datadir}/%{name}/completions/ag.bashcomp.sh
|
||||
-
|
||||
+%config %{_datadir}/zsh/site-functions/_the_silver_searcher
|
||||
|
||||
%changelog
|
||||
* Thu Dec 5 2013 Emily Strickland <code@emily.st> - 0.18.1-1
|
||||
diff -Nur a/.travis.yml b/.travis.yml
|
||||
--- a/.travis.yml 2018-08-07 14:43:51.000000000 +0800
|
||||
+++ b/.travis.yml 2020-07-05 03:27:44.000000000 +0800
|
||||
@@ -1,4 +1,5 @@
|
||||
language: c
|
||||
+dist: xenial
|
||||
sudo: false
|
||||
|
||||
branches:
|
||||
@@ -22,12 +23,12 @@
|
||||
|
||||
env:
|
||||
global:
|
||||
- - LLVM_VERSION=3.8.0
|
||||
+ - LLVM_VERSION=6.0.1
|
||||
- LLVM_PATH=$HOME/clang+llvm
|
||||
- CLANG_FORMAT=$LLVM_PATH/bin/clang-format
|
||||
|
||||
before_install:
|
||||
- - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_PATH.tar.xz
|
||||
+ - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O $LLVM_PATH.tar.xz
|
||||
- mkdir $LLVM_PATH
|
||||
- tar xf $LLVM_PATH.tar.xz -C $LLVM_PATH --strip-components=1
|
||||
- export PATH=$HOME/.local/bin:$PATH
|
||||
@@ -37,3 +38,9 @@
|
||||
|
||||
script:
|
||||
- ./build.sh && make test
|
||||
+
|
||||
+notifications:
|
||||
+ irc: 'chat.freenode.net#ag'
|
||||
+ on_success: change
|
||||
+ on_failure: always
|
||||
+ use_notice: true
|
||||
@ -1,204 +0,0 @@
|
||||
From 599abc8075063f7a29e47224e83135541118781c Mon Sep 17 00:00:00 2001
|
||||
From: zhangtao2020 <zhangtao221@huawei.com>
|
||||
Date: Fri, 6 Aug 2021 23:49:25 -0400
|
||||
Subject: [PATCH] fix build error gcc10
|
||||
|
||||
---
|
||||
src/ignore.c | 2 ++
|
||||
src/ignore.h | 2 +-
|
||||
src/log.c | 1 +
|
||||
src/log.h | 2 +-
|
||||
src/options.c | 2 ++
|
||||
src/options.h | 2 +-
|
||||
src/search.c | 13 +++++++++++++
|
||||
src/search.h | 21 ++++++++++-----------
|
||||
src/util.c | 3 +++
|
||||
src/util.h | 4 ++--
|
||||
10 files changed, 36 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/ignore.c b/src/ignore.c
|
||||
index fa41889..32464d7 100644
|
||||
--- a/src/ignore.c
|
||||
+++ b/src/ignore.c
|
||||
@@ -20,6 +20,8 @@
|
||||
const int fnmatch_flags = FNM_PATHNAME;
|
||||
#endif
|
||||
|
||||
+ignores *root_ignores;
|
||||
+
|
||||
/* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */
|
||||
|
||||
const char *evil_hardcoded_ignore_files[] = {
|
||||
diff --git a/src/ignore.h b/src/ignore.h
|
||||
index 20d5a6a..8db0f37 100644
|
||||
--- a/src/ignore.h
|
||||
+++ b/src/ignore.h
|
||||
@@ -29,7 +29,7 @@ struct ignores {
|
||||
};
|
||||
typedef struct ignores ignores;
|
||||
|
||||
-ignores *root_ignores;
|
||||
+extern ignores *root_ignores;
|
||||
|
||||
extern const char *evil_hardcoded_ignore_files[];
|
||||
extern const char *ignore_pattern_files[];
|
||||
diff --git a/src/log.c b/src/log.c
|
||||
index 1481b6d..f6f4e9a 100644
|
||||
--- a/src/log.c
|
||||
+++ b/src/log.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
+pthread_mutex_t print_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
static enum log_level log_threshold = LOG_LEVEL_ERR;
|
||||
|
||||
void set_log_level(enum log_level threshold) {
|
||||
diff --git a/src/log.h b/src/log.h
|
||||
index 85847ee..318622c 100644
|
||||
--- a/src/log.h
|
||||
+++ b/src/log.h
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
-pthread_mutex_t print_mtx;
|
||||
+extern pthread_mutex_t print_mtx;
|
||||
|
||||
enum log_level {
|
||||
LOG_LEVEL_DEBUG = 10,
|
||||
diff --git a/src/options.c b/src/options.c
|
||||
index dbe3e24..2bc6d85 100644
|
||||
--- a/src/options.c
|
||||
+++ b/src/options.c
|
||||
@@ -20,6 +20,8 @@ const char *color_line_number = "\033[1;33m"; /* bold yellow */
|
||||
const char *color_match = "\033[30;43m"; /* black with yellow background */
|
||||
const char *color_path = "\033[1;32m"; /* bold green */
|
||||
|
||||
+cli_options opts;
|
||||
+
|
||||
/* TODO: try to obey out_fd? */
|
||||
void usage(void) {
|
||||
printf("\n");
|
||||
diff --git a/src/options.h b/src/options.h
|
||||
index db3e896..fd7d1f0 100644
|
||||
--- a/src/options.h
|
||||
+++ b/src/options.h
|
||||
@@ -91,7 +91,7 @@ typedef struct {
|
||||
} cli_options;
|
||||
|
||||
/* global options. parse_options gives it sane values, everything else reads from it */
|
||||
-cli_options opts;
|
||||
+extern cli_options opts;
|
||||
|
||||
typedef struct option option_t;
|
||||
|
||||
diff --git a/src/search.c b/src/search.c
|
||||
index 14e9d41..829ab4b 100644
|
||||
--- a/src/search.c
|
||||
+++ b/src/search.c
|
||||
@@ -2,6 +2,19 @@
|
||||
#include "print.h"
|
||||
#include "scandir.h"
|
||||
|
||||
+size_t alpha_skip_lookup[256];
|
||||
+size_t *find_skip_lookup;
|
||||
+uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+
|
||||
+work_queue_t *work_queue = NULL;
|
||||
+work_queue_t *work_queue_tail = NULL;
|
||||
+int done_adding_files = 0;
|
||||
+pthread_cond_t files_ready = PTHREAD_COND_INITIALIZER;
|
||||
+pthread_mutex_t stats_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+pthread_mutex_t work_queue_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+symdir_t *symhash = NULL;
|
||||
+
|
||||
void search_buf(const char *buf, const size_t buf_len,
|
||||
const char *dir_full_path) {
|
||||
int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */
|
||||
diff --git a/src/search.h b/src/search.h
|
||||
index 1071114..bbd3036 100644
|
||||
--- a/src/search.h
|
||||
+++ b/src/search.h
|
||||
@@ -31,9 +31,9 @@
|
||||
#include "uthash.h"
|
||||
#include "util.h"
|
||||
|
||||
-size_t alpha_skip_lookup[256];
|
||||
-size_t *find_skip_lookup;
|
||||
-uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+extern size_t alpha_skip_lookup[256];
|
||||
+extern size_t *find_skip_lookup;
|
||||
+extern uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
|
||||
struct work_queue_t {
|
||||
char *path;
|
||||
@@ -41,13 +41,12 @@ struct work_queue_t {
|
||||
};
|
||||
typedef struct work_queue_t work_queue_t;
|
||||
|
||||
-work_queue_t *work_queue;
|
||||
-work_queue_t *work_queue_tail;
|
||||
-int done_adding_files;
|
||||
-pthread_cond_t files_ready;
|
||||
-pthread_mutex_t stats_mtx;
|
||||
-pthread_mutex_t work_queue_mtx;
|
||||
-
|
||||
+extern work_queue_t *work_queue;
|
||||
+extern work_queue_t *work_queue_tail;
|
||||
+extern int done_adding_files;
|
||||
+extern pthread_cond_t files_ready;
|
||||
+extern pthread_mutex_t stats_mtx;
|
||||
+extern pthread_mutex_t work_queue_mtx;
|
||||
|
||||
/* For symlink loop detection */
|
||||
#define SYMLOOP_ERROR (-1)
|
||||
@@ -64,7 +63,7 @@ typedef struct {
|
||||
UT_hash_handle hh;
|
||||
} symdir_t;
|
||||
|
||||
-symdir_t *symhash;
|
||||
+extern symdir_t *symhash;
|
||||
|
||||
void search_buf(const char *buf, const size_t buf_len,
|
||||
const char *dir_full_path);
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index e509e58..5ea71d1 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -21,6 +21,9 @@
|
||||
} \
|
||||
return ptr;
|
||||
|
||||
+FILE *out_fd = NULL;
|
||||
+ag_stats stats;
|
||||
+
|
||||
void *ag_malloc(size_t size) {
|
||||
void *ptr = malloc(size);
|
||||
CHECK_AND_RETURN(ptr)
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index 4350822..e158714 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "options.h"
|
||||
|
||||
-FILE *out_fd;
|
||||
+extern FILE *out_fd;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
@@ -51,7 +51,7 @@ typedef struct {
|
||||
} ag_stats;
|
||||
|
||||
|
||||
-ag_stats stats;
|
||||
+extern ag_stats stats;
|
||||
|
||||
/* Union to translate between chars and words without violating strict aliasing */
|
||||
typedef union {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
BIN
the_silver_searcher-2.2.0.tar.gz
Normal file
BIN
the_silver_searcher-2.2.0.tar.gz
Normal file
Binary file not shown.
@ -1,27 +1,21 @@
|
||||
%global commit 1a5e259b259130b50607174fc9f9508dc1f2941c
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
%global bashcompdir %(pkg-config --variable=completionsdir bash-completion)
|
||||
%if "%{bashcompdir}" == ""
|
||||
%define bashcompdir "/etc/bash_completion.d"
|
||||
%endif
|
||||
|
||||
Name: the_silver_searcher
|
||||
Version: 2.1.0
|
||||
Release: 4
|
||||
Version: 2.2.0
|
||||
Release: 1
|
||||
Summary: Super-fast text searching tool (ag)
|
||||
Group: Applications/Text
|
||||
License: ASL 2.0 and BSD
|
||||
URL: https://github.com/ggreer/the_silver_searcher
|
||||
Source: https://github.com/ggreer/the_silver_searcher/archive/%{commit}/%{version}-%{shortcommit}.tar.gz
|
||||
Source: https://github.com/ggreer/the_silver_searcher/archive/%{version}/the_silver_searcher-%{version}.tar.gz
|
||||
# https://github.com/ggreer/the_silver_searcher/compare/2.2.0...5a1c8d83ba.patch
|
||||
Patch0: 5a1c8d83ba.patch
|
||||
# https://github.com/ggreer/the_silver_searcher/pull/1145
|
||||
Patch1: 0001-update-zsh-completion-for-new-options.patch
|
||||
# https://github.com/ggreer/the_silver_searcher/pull/1410
|
||||
Patch2: 0002-Install-shell-completion-files-to-correct-locations.patch
|
||||
|
||||
Patch1: fix-build-error-gcc10.patch
|
||||
|
||||
BuildRequires: autoconf gcc
|
||||
BuildRequires: autoconf gcc uthash-devel
|
||||
BuildRequires: automake make
|
||||
BuildRequires: pcre-devel
|
||||
%if ! 0%{?el6}
|
||||
BuildRequires: pkgconfig(bash-completion)
|
||||
%endif
|
||||
BuildRequires: xz-devel
|
||||
BuildRequires: zlib-devel
|
||||
|
||||
@ -30,36 +24,32 @@ The Silver Searcher is a code searching tool similar to ack,
|
||||
with a focus on speed.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{commit}
|
||||
%patch1 -p1
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
rm src/uthash.h
|
||||
sed -e '/ag_SOURCES/ s/ src\/uthash.h//' -i Makefile.am
|
||||
|
||||
%build
|
||||
aclocal
|
||||
autoconf
|
||||
autoheader
|
||||
automake --add-missing
|
||||
%configure --disable-silent-rules
|
||||
make %{?_smp_mflags}
|
||||
%make_build
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{bashcompdir}
|
||||
install -pm 0644 ag.bashcomp.sh $RPM_BUILD_ROOT%{bashcompdir}/ag
|
||||
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||
%make_install
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{_bindir}/ag
|
||||
%{_mandir}/man1/ag.1*
|
||||
%(dirname %{bashcompdir})
|
||||
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
|
||||
%doc README.md
|
||||
%license LICENSE
|
||||
%else
|
||||
%doc README.md LICENSE
|
||||
%endif
|
||||
# zsh completion
|
||||
%{_datadir}/zsh/site-functions/_%{name}
|
||||
|
||||
%{_datadir}/bash-completion/completions/ag
|
||||
%{_datadir}/zsh/site-functions/_ag
|
||||
%changelog
|
||||
* Sat Sep 16 2023 liyanan <thistleslyn@163.com> - 2.2.0-1
|
||||
- Update to 2.2.0
|
||||
|
||||
* Tue Dec 13 2022 wangkai <wangkai385@h-partners.com> - 2.1.0-4
|
||||
- Add make for buildrequires
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user