Commit Graph

8132 Commits

Author SHA1 Message Date
ridiculousfish
d09210c08b [cmake] Untangle the CMake versioning
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.

The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.

This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.

We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
2018-01-08 22:28:10 -08:00
ridiculousfish
21cfdf04bd Revert "[cmake] Remove build_fish_pc target"
This reverts commit 585321181d.

With the build_fish_pc target, a command like this fails:
  env DESTDIR=/tmp/fish-install ninja install
2018-01-08 22:28:10 -08:00
ridiculousfish
da8db7f6f0 Revert "Generate FISH_BUILD_VERSION info for cmake builds"
This reverts commit 25839b8c36.

This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
2018-01-08 22:28:10 -08:00
Fabian Homborg
d67b4d6ca7 Fix {,,,} tests
There was an additional line in the output
2018-01-07 15:00:44 +01:00
Fabian Homborg
aa58cae601 Don't count successive "," as literal in brace expansion
This was highly surprising.

Fixes #3002.
2018-01-07 15:00:44 +01:00
Fabian Homborg
55ebf4430f Make literal "{}" expand to itself
This caused major annoyances with e.g. `find -exec`, and it's utterly
useless - "{}" expands to nothing, so why have it at all?

Fixes #1109.
2018-01-07 15:00:44 +01:00
MindTooth
721df61f4b brew.fish: add the leaves option (#4645) 2018-01-06 12:39:15 +01:00
pinage404
1af4acbd0e Add: ngrok completions (#4642)
Completions are based on the help messages of [ngrok](https://ngrok.com/)
2018-01-05 15:30:58 +01:00
emiliano
3cabed88e2 Add --no-color to more git invocations (#4636)
This breaks when git has been set to always print in color.
2018-01-03 14:35:27 +01:00
Fabian Homborg
3650712ff2 python completions: Disable file completion
Otherwise the prior commit was pointless.
2018-01-01 13:18:55 +01:00
Fabian Homborg
66f181499b Strip quotes in __fish_complete_suffix
Fixes #4481.
2018-01-01 13:18:40 +01:00
Fabian Homborg
75ac482cec Don't crash when setting fish_history before reader is initialized
Not crashing is just soo much nicer.

Fixes #4619.
2018-01-01 13:02:39 +01:00
Fabian Homborg
585321181d [cmake] Remove build_fish_pc target
The dependency on fish.pc just does not work.

This still installs the pc file with the proper version, so it should work.
2018-01-01 13:02:39 +01:00
David Adam
fe4354e5ed Merge branch 'Integration_2.7.1' 2018-01-01 08:48:41 +08:00
Mahmoud Al-Qudsi
d31be65a30 Don't add FISH_BUILD_VERSION to the C++ defines
Including it as -DFISH_BUILD_VERSION causes a full re-compile as ninja
detects that the C++ compiler parameters have changed.
2017-12-30 17:42:02 -06:00
Mahmoud Al-Qudsi
25839b8c36 Generate FISH_BUILD_VERSION info for cmake builds
Correctly generate FISH_BUILD_VERSION for use in fish_version.h/cpp and
fish.pc to allow `fish --version` and `echo $version` to work again.

Not needing the same convoluted measures used by Makefile builds to
prevent the regeneration of the fish version file when it hasn't
changed.

Purposely created a new `cmake_git_version_gen.sh` file so that the old
`git_version_gen.sh` remains compatible with the existing Makefile build
script. Same reason why `fish.pc.in` was not modified to use a lowercase
variable name to match the CMAKE variable of the same name.

Closes #4626
2017-12-30 17:38:09 -06:00
ridiculousfish
69f066dc1b Correct end tag
A code block was not properly closed, causing bad graphical artifacts
in the tutorial. Correct it.
2017-12-29 12:44:09 -08:00
Mahmoud Al-Qudsi
87f7cd0370 Fix make install failure on missing man pages
If `doxygen` isn't installed, the man files aren't built and that's
quite ok. The cmake `install` target was presuming the man files would
always be present and the install stage was failing if they weren't
built.
2017-12-28 15:22:31 -06:00
Mahmoud Al-Qudsi
36a2f2cc01 Work around cmake/ninja bug that leads to installation failure
CMake originally links build artifacts/results so that they can run from
the target directory. As a result, it must first relink the binaries
before installation so that they can run from the installation target
directory, typically done in the preinstall stage. Ninja does not have a
preinstall stage, and the CMake code that generates the build.ninja file
does not take that into account [0].

Setting `CMAKE_BUILD_WITH_INSTALL_RPATH` [1] makes it originally link
the files with the RPATH settings for the final destination directory,
meaning that relinking is no longer needed.

Technically setting the RPATH is not required for the `fish` binary as
we do not have any relative dependencies; this is the output of
`ldd ./build/fish`:

```
linux-vdso.so.1 =>  (0x00007ffffacdc000)
libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5
(0x00007f6632350000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5
(0x00007f6632120000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
(0x00007f6631f00000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(0x00007f6631b70000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
(0x00007f6631860000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f6631630000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f6631410000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
(0x00007f6631040000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6632600000)
```

However, since the bug only exists when the build generator is set to
ninja, the workaround is only activated for that specific build
generator to prevent any future problems.

[0]: https://cmake.org/Bug/print_bug_page.php?bug_id=13934
[1]: https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.html
2017-12-28 15:15:58 -06:00
Mahmoud Al-Qudsi
0aa4c4a483 Add git completions for git push REMOTE :BRANCH
`git push REMOTE :BRANCH` deletes remote branch BRANCH from remote
REMOTE. Should only kick in when the pattern matches, hopefully didn't
break anything else!
2017-12-28 14:26:40 -06:00
ridiculousfish
3b3047c3f6 Remove unused functions from env_var_t 2017-12-24 00:03:28 -08:00
ridiculousfish
8f8e19bf7b Fix a misleading stale comment 2017-12-22 19:35:59 -08:00
ridiculousfish
d5d3712220 Correct some more memory management in env.cpp 2017-12-22 17:38:25 -08:00
ridiculousfish
efeb8e43a2 Remove a bunch of unnecessary copying in env.cpp 2017-12-22 17:31:25 -08:00
ridiculousfish
2c5b49c3fe Clean up env_var_t interface 2017-12-22 16:54:15 -08:00
ridiculousfish
05b5e8e4f8 Stop copying strings in var_stack_t::var_changed
var_stack_t::var_changed was doing tons of unnecessary string copies.
Fix that and make its name clearer.
2017-12-22 16:28:15 -08:00
ridiculousfish
aa22c744d2 Mark parsed_source_ref_t as storing a const pointer 2017-12-22 15:44:14 -08:00
ridiculousfish
457213a768 Turn debug() into a macro
A large portion of time was spent constructing strings and passing
them to debug(). Turn debug into a macro so that the strings are only
constructed if they're going to be printed.
2017-12-22 15:19:08 -08:00
ridiculousfish
a99eecfad8 Wrap up source code and a parse tree into a new type parsed_source_ref_t
This will make it unnecessary to carry around the parse tree and source
separately, and enable some simplifications.
2017-12-22 14:40:15 -08:00
ridiculousfish
eeff32cde7 Disable MUPARSER_ATTR_WARN_UNUSED_RESULT on gcc
Fixes a warning when building with gcc.
2017-12-22 13:45:27 -08:00
ridiculousfish
d17b298a48 Factor out the code that executes a builtin from exec_job()
Very early work on untangling the exec_job spaghetti.
2017-12-22 13:41:29 -08:00
ridiculousfish
7db5d573c2 Document fish_color_selection
Fixes #4544
2017-12-22 12:41:35 -08:00
David Adam
b680db8ce6 Bump version for 2.7.1 2017-12-23 00:16:29 +08:00
David Adam
cd5c40ed9c CHANGELOG: update for 2.7.1 2017-12-23 00:16:24 +08:00
David Adam
fd10c29211 Disable __update_cwd_osx for iTerm.app
Fixes #4521.

(cherry picked from commit 5faa425df1)
2017-12-22 22:10:36 +08:00
ridiculousfish
9907a8df4d Fix test hang when running under ninja
The psub tests create a fifo and launch a background job to write to it.
However fifos have this obnoxious behavior where opening the file blocks
until both sides are ready. In one of the tests we don't actually read
from the fifo we create, so the background job hangs, and the tests
never complete. Fix this by just reading from the fifo.
2017-12-21 15:48:48 -08:00
ridiculousfish
a2114233ac Fix some warnings 2017-12-21 15:48:48 -08:00
Fabian Homborg
4096a7fda9 Revert "Fix "Unknown argument -s" error in fish_vi_key_bindings"
Unfortunately this made tests on travis fail - for some reason I still need to figure out.

This reverts commit 5acbd32c2e.
2017-12-22 00:44:18 +01:00
ridiculousfish
f563262cfd Mark tests as USES_TERMINAL
This allows the Ninja build to show the test output live.
This requires bumping the min required CMake version to 3.2 (from 3.1)
2017-12-21 12:48:17 -08:00
ridiculousfish
0c55b79cfc [string] Instance the argument parsing
This adds a new class arg_iterator_t which encapsulates decisions about
whether to read arguments from stdin or argv. It also migrates the
unread bytes buffer from a static variable to an instance variable.
2017-12-21 12:42:57 -08:00
Yurizal Susanto
94ff789c4b Add eopkg completion support (#4600)
* Add eopkg support

Add support for eopkg in __fish_print_packages function, and
add new completion eopkg.fish in share/completions

* Sorry for the empty file

* Sorry for the empty file again

* Use builtin function for checking subcommand and options

* Fix description

* Use string function to replace grep and cut

* Add completion for search command
2017-12-21 16:43:21 +01:00
David Guyot
dcf9ce6fc5 Added completions/translations for zfs and zpool 2017-12-21 16:39:06 +01:00
Fabian Homborg
5acbd32c2e Fix "Unknown argument -s" error in fish_vi_key_bindings
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].

As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.

Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.

Fixes #4494.
2017-12-21 16:17:21 +01:00
Fabian Homborg
884092d13b CHANGELOG 4610 2017-12-20 14:36:13 +01:00
Fabian Homborg
f9d883dd74 Add and use str2wcstring(string, size_t)
This is just for convenience.
2017-12-20 14:31:29 +01:00
Fabian Homborg
2de38ef7bf [string] Chunk reads
Profiling with callgrind revealed that about 60% of the time in a `something | string match` call
was actually spent in `string_get_arg_stdin()`,
because it was calling `read` one byte at a time.

This makes it read in chunks similar to builtin read.

This increases performance for `getent hosts | string match -v '0.0.0.0*'` from about 300ms to about 30ms (i.e. 90%).
At that point it's _actually_ quicker than `grep`.

To improve performance even more, we'd have to cut down on str2wcstring.

Fixes #4604.
2017-12-20 14:30:41 +01:00
ridiculousfish
ec2b38053e
Merge pull request #4612 from ridiculousfish/muparser-no-except
Muparser Exceptectomy

This removes large pieces of muParser that fish does not use, such as its optimizer. It also switches muParser from throwing exceptions to propagating errors explicitly.
2017-12-19 09:34:32 -08:00
ridiculousfish
873ea0f0df [muparser] Remove OnDetectVar and Diff
These are unused and useless.
2017-12-18 23:01:18 -08:00
ridiculousfish
2c317a2585 [muparser] Remove muParserFixes.h
This appears to be random pragmas for ICC only.
2017-12-18 23:01:18 -08:00
ridiculousfish
886341fdea [muparser] Remove ParserCallback m_bAllowOpti flag
muParser can no longer optimize, so this is unused.
2017-12-18 23:01:18 -08:00