Commit Graph

13368 Commits

Author SHA1 Message Date
David Adam
bdb99168f0 CHANGELOG: work on 3.2.0 2020-12-31 22:06:25 +08:00
ridiculousfish
f03ff8cd00 Add a test for history path detection
This will support history path detection improvements in a future
commit.
2020-12-30 00:44:25 -08:00
Johannes Altmanninger
686d64cf05 Disable some clang-tidy lints with false positives
One warns about using system() which we only use in test code (we're all adults):

	src/fish_tests.cpp:2015:9: warning: calling 'system' uses a command processor [cert-env33-c]
	    if (system("mkdir -p test/fish_expand_test/bb/")) err(L"mkdir failed");

Some conversion warnings that don't seem very useful:

	src/input_common.cpp:181:20: warning: 'signed char' to 'wint_t' (aka 'unsigned int') conversion; consider casting to 'unsigned char' first. [cert-str34-c]
	        wint_t b = evt.get_char();

Warning about varargs doesn't make sense, because some of our functions use std::vswprintf() internally.

	src/ast.cpp:486:10: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead [cert-dcl50-cpp]
	    void internal_error(const char *func, const wchar_t *fmt, ...) const {

Finally, what seems like a false positive; "va" is initialized by va_copy:

	src/common.cpp:468:18: warning: Function 'vswprintf' is called with an uninitialized va_list argument [clang-analyzer-valist.Uninitialized]
	        status = std::vswprintf(buff, size / sizeof(wchar_t), format, va);
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
801955851b Workaround clang-tidy incorrectly assuming null
This silences a false positive linter warning about a null dereference.
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
8fc9b9d61b Address some minor lints
A mildly interesting one is the call to test_wchar2utf8 with a non-null
pointer ("u1"/"dst") but 0 length. In this case we relied on malloc(0)
returning non-null which is not guaranteed.

	src/fish_tests.cpp:1619:23: warning: Call to 'malloc' has an allocation
	size of 0 bytes [clang-analyzer-optin.portability.UnixAPI]
	        mem = (char *)malloc(dlen);
	                      ^
	test_wchar2utf8(w1, sizeof(w1) / sizeof(*w1), u1, 0, 0, 0,
			"invalid params, dst is not NULL");
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
a205225b4e lint.fish: properly handle -I and -D args for cppcheck
lint.fish receives arguments that contain multiple includes and defines.
As a result, we passed arguments like
"-I/usr/include -I$HOME/fish-shell/build -I/usr/include"
to cppcheck which interprets this as a single include directory.
This leads to errors like this one (because the "build" dir was missing):

	src/common.h:4:0: information: Include file: "config.h" not found. [missingInclude]
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
f0f5724e18 CONTRIBUTING: Debian provides a "clang-format" package 2020-12-29 16:31:43 +01:00
Johannes Altmanninger
39a3aa0c2d CONTRIBUTING: shorten and remove stale description
We do use "// clang-format off" (once).
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
ad3b76eeb7 CONTRIBUTING: stop recommending deprecated Vim plugin
The description on the plugin page says "!!!Deprecated!!!".
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
53d922bde6 build_tools/lint.fish: correct cppcheck config location
Which was moved in 9b3bfb63d ("cppcheck: Move config files to build_tools")
Also get rid of the nonstandard cppcheck output format.
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
69a9785f50 Refactor: pass by value, not reference, to enable move semantics
clang-tidy wrote:
> warning: passing result of std::move() as a const reference argument;
> no move will actually happen [performance-move-const-arg]
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
c890982c90 GNUMakefile: remove redundant CMake arguments 2020-12-29 16:31:43 +01:00
Johannes Altmanninger
a24ceaf0df completions/git: offer ranges for cherry-pick 2020-12-29 16:31:43 +01:00
Johannes Altmanninger
85830a5775 completions/git: don't sort branches and tags
This seems a bit more intuitive.
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
84262b126b build_tools/style.fish: don't format other Python files 2020-12-29 16:31:43 +01:00
Fabian Homborg
4c09012b0d tests: Don't rely on $HOME existing
Apparently the launchpad tests run with $HOME set to a nonexistent
directory. Since we just want *out*, let's just store the previous dir
and go back.
2020-12-29 12:48:11 +01:00
ridiculousfish
43505f7077 Allow ** glob segments to match zero directories
Prior to this change, a glob like `**/file.txt` would only match
`file.txt` in subdirectories; the `**` must match at least one directory.
This is historical behavior.

With this change we move a little closer to bash's implementation by
allowing a literal `**` segment to match in the current directory. That
is, `**/foo` will match both `foo` and `bar/foo`, while `b**/foo` will
only match `bar/foo`.

Fixes #7222.
2020-12-28 23:51:18 -08:00
ridiculousfish
6c08141682 Add a littlcheck glob test
We have some glob tests in fish_tests.cpp, but they are hard to follow.
Begin migrating them
2020-12-28 23:51:18 -08:00
ridiculousfish
df73964ced Clean up some comments around wildcard expansion 2020-12-28 23:51:18 -08:00
Fabian Homborg
3c2cf6241b Add some error tests for cd
Makes work on #7577 easier.
2020-12-28 23:23:06 +01:00
elpres
aaeb7d107c Fixed sentence in fish_hg_prompt docs 2020-12-28 19:39:27 +01:00
Matthew Dutson
bc91a13ba3 Revise through "Quotes" section 2020-12-27 17:57:09 +01:00
Ilan Cosman
94d18c1ac5 CHANGELOG: Add missing --query 2020-12-26 23:18:14 +01:00
ridiculousfish
315f8f8a83 Relnote ldapsearch completions
[ci skip]
2020-12-26 12:16:46 -08:00
Nunzarius
d3de09da83 Added completions for ldapsearch 2020-12-26 12:13:44 -08:00
Fabian Homborg
17ceb71169 Increase issue lock time to half a year
Sometimes three months is quite soon, let's see how half a year works out.
2020-12-26 19:36:55 +01:00
Fabian Homborg
a6674483c1 CHANGELOG: Add more issues to 3.2
Importantly I had added some of the `math` things to 3.1 by accident,
this movs them to 3.2
2020-12-26 19:36:24 +01:00
Johannes Altmanninger
d6dd532d6a Do support the new realpath -s in our wrapper function
See #7574
2020-12-26 08:56:34 +01:00
Fabian Homborg
39e1494c56 docs: A bit more on variables 2020-12-24 10:30:59 +01:00
Johannes Altmanninger
322ceb7ab4 builtin realpath: use absolute path also with -s/--no-symlinks
The old test needs to be changed because $XDG_DATA_HOME can be relative.

Fixes #7574
2020-12-24 08:53:08 +01:00
Johannes Altmanninger
4dae106911 Use complete --keep-order with __fish_complete_suffix to prioritize files with matching suffixes
Part of #7040
2020-12-23 19:14:10 +01:00
Johannes Altmanninger
bae75c96d9 __fish_complete_suffix: complete all files, but sort files with matching suffix first
See #7040 and others.
2020-12-23 19:14:10 +01:00
Johannes Altmanninger
d18e1c7bca Revert "completions/unzip: Stop filtering suffixes"
This reverts commit 46068cd257.
2020-12-23 19:14:10 +01:00
ridiculousfish
e43913a547 Stop expanding globs in command position when performing error checking
Before running a command, or before importing a command from bash history,
we perform error checking. As part of error checking we expand commands
including variables and globs. If the glob is very large, like `/**`, then
we could hang expanding it.

One fix would be to limit the amount of expansion from the glob, but
instead let's just not expand command globs when performing error checking.

Fixes #7407
2020-12-22 12:38:51 -08:00
ridiculousfish
a8080e8e6f Allow specifying a limit on number of expansion in operation_context
If the user types something like `/**`, prior to this change we would
attempt to expand it in the background for both highlighting and
autosuggestions. This could thrash your disk and also consume a lot of
memory.

Add a a field to operation_context_t to allow specifying a limit, and add
a "default background" limit of 512 items.
2020-12-22 12:38:51 -08:00
ridiculousfish
0f2d73e4a3 Remove a stale comment 2020-12-22 12:38:51 -08:00
ridiculousfish
c2c729352e Eagerly abort wildcard completions for ** wildcards
Historically fish has not supported tab completing or autosuggesting
wildcards with **. Prior to this fix, we would test every file match,
discover the ** wildcard, and then ignore it. Instead look for **
wildcards at the top level.

This prevents autosuggesting with /** from chewing up your disk.
2020-12-22 12:38:51 -08:00
ridiculousfish
10362a70df Clean up parse_error_offset_source_start
Use range-based for loops and relax the requirement that we have an
error list.
2020-12-22 12:38:51 -08:00
Fabian Homborg
04d7d89020 __fish_print_packages: Extract the rest
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)

Zypper can be dropped, as that already used a separate function in the file.

Apk can just be inlined - it's literally one line for installed and another for all packages.
2020-12-22 17:10:02 +01:00
Fabian Homborg
cf59c3b680 completions/eopkg: Rework some comments 2020-12-22 17:10:02 +01:00
Fabian Homborg
97838657b9 Extract creating $XDG_CACHE_HOME into its own function 2020-12-22 17:10:02 +01:00
Fabian Homborg
24012b1941 __fish_print_packages: Break apart
This function doesn't make any sense.

Most things that expect package names expect package names for *one
specific package manager*.

It only happens to work, most of the time, because most people only
have one package manager installed.
2020-12-22 17:10:02 +01:00
Nunzarius
f7966b3249 Added completions 2020-12-22 17:06:27 +01:00
Ivan Tham
c5343a538f Add cargo abbr completions 2020-12-21 23:05:31 +01:00
ridiculousfish
38a30d1798 Mark subclasses of io_data_t as final 2020-12-19 20:06:36 -08:00
ridiculousfish
c1cfefa057 Attempt to fix the ubuntu 32 bit vendored PCRE build
Use 'apt update' and see what happens
2020-12-19 18:22:10 -08:00
Shun Sakai
58d9fa3820 Add completions for .NET 2020-12-19 16:55:24 -08:00
ridiculousfish
6f2e377fcc Clean up some unnecessary variable names in maybe.h 2020-12-19 16:10:40 -08:00
ridiculousfish
0028dce9ed Add a centos7 Dockerfile
This tests building and running on centos7 with gcc 4.8.
To run it:

    ./docker/docker_run_tests.sh ./docker/centos7.Dockerfile
2020-12-19 15:17:42 -08:00
ridiculousfish
f61f45748e Document insert-line-under and insert-line-over bindings 2020-12-19 14:32:17 -08:00