Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tig: fix zsh completion #47234

Merged
merged 1 commit into from Sep 23, 2018
Merged

tig: fix zsh completion #47234

merged 1 commit into from Sep 23, 2018

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Sep 23, 2018

Motivation for this change

The ZSH completion script of tig basically imports the bash completion
script and uses it as completion approach. Unfortunately the script
takes several assumptions about the directory structure using
$funcsourcetrace[1] that don't apply on NixOS.

The easiest workaround is t opatch the completion script and import the
bash completion script from $out.

[1] http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#index-funcsourcetrace

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

The ZSH completion script of `tig` basically imports the bash completion
script and uses it as completion approach. Unfortunately the script
takes several assumptions about the directory structure using
`$funcsourcetrace`[1] that don't apply on NixOS.

The easiest workaround is t opatch the completion script and import the
bash completion script from `$out`.

[1] http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#index-funcsourcetrace
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tig

Partial log (click to expand)

rm doc/tigmanual.7.xml doc/tig.1.xml doc/tigrc.5.xml
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1
shrinking /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1/bin/.tig-wrapped
gzipping man pages under /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1/share/man/
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1/bin
patching script interpreter paths in /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1
checking for references to /build in /nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1...
/nix/store/4sdv4nxbsi70hvfxiwgks7s4mdviyrqn-tig-2.4.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tig

Partial log (click to expand)

rm doc/tigmanual.7.xml doc/tig.1.xml doc/tigrc.5.xml
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1
shrinking /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1/bin/.tig-wrapped
gzipping man pages under /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1/share/man/
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1/bin
patching script interpreter paths in /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1
checking for references to /build in /nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1...
/nix/store/1flkh4fcjd812vcz8szfbanj16sgn8wp-tig-2.4.1

@Mic92
Copy link
Member

Mic92 commented Sep 23, 2018

Do you know why I have to explicitly source this file also it is in my fpath?

$ echo $fpath
/home/joerg/.zsh-completions /usr/local/share/zsh/site-functions /usr/local/share/zsh/site-functions /nix/store/ia8kkrzlmqy91wc3vpzj5x2vw1hyr8dd-zsh-5.6.2/share/zsh/site-functions /nix/store/ia8kkrzlmqy91wc3vpzj5x2vw1hyr8dd-zsh-5.6.2/share/zsh/5.6.2/functions /etc/profiles/per-user/joerg/share/zsh/site-functions /etc/profiles/per-user/joerg/share/zsh/5.6.2/functions /etc/profiles/per-user/joerg/share/zsh/vendor-completions /run/current-system/sw/share/zsh/site-functions /run/current-system/sw/share/zsh/5.6.2/functions /run/current-system/sw/share/zsh/vendor-completions /nix/var/nix/profiles/default/share/zsh/site-functions /nix/var/nix/profiles/default/share/zsh/5.6.2/functions /nix/var/nix/profiles/default/share/zsh/vendor-completions /home/joerg/.nix-profile/share/zsh/site-functions /home/joerg/.nix-profile/share/zsh/5.6.2/functions /home/joerg/.nix-profile/share/zsh/vendor-completions
$ cat /home/joerg/.nix-profile/share/zsh/site-functions/_tig

If I do:

source /home/joerg/.nix-profile/share/zsh/site-functions/_tig

It works.

@Mic92 Mic92 merged commit e1ef438 into NixOS:master Sep 23, 2018
@Mic92
Copy link
Member

Mic92 commented Sep 23, 2018

It was still in my global fpath.

@Mic92
Copy link
Member

Mic92 commented Sep 23, 2018

backport: 19e8f7c

@Ma27 Ma27 deleted the fix-tig-zsh-completion branch September 23, 2018 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants