How to 'git bisect run ' with ZSH function

124 Views Asked by At

Previously in BASH I used 'git bisect run' with 'script.sh param1 param2'. I use ZSH now and I converted scripts to functions in a single functions-file, for easier editing. Sourced functions-file.

How can I 'git bisect run' with ZSH function (not separate script file)?

Tried 'git bisect run zsh -c "sourced-function param1 param2 param3"' but that gives "zsh:1: command not found: sourced-function", although in zsh I can run "sourced-function".

Found this `git bisect run` with a bash function mentioning that in Git 2.40+ git bisect becomes a builtin - but did not understand if that affects my problem. Other suggested answer, exporting functions, seems impractical especially in ZSH.

EDIT: Later found zsh and parallel: How to use functions. It says command not found which seems related but IDK how to apply that in feasible manner. Not clear how to activate env_parallel and where.

I do not have 50 points to ask for clarification in comments.

PS: Seems that proper approach is to use zsh path for functions as separate files and autoload, not to source single file with functions. But I prefer this way, so question remains.

1

There are 1 best solutions below

4
Jay On

Shells usually won't execute their function-loading startup scripts when run in non-interactive mode.

For zsh you should be able to manually load those scripts/functions using the source built-in command:

git bisect run zsh -c 'source "$HOME"/.zshrc; sourced-function param1 param2 param3'