Move the `_which` function (almost) to the top
commitfd477a1d3bab580c2fcdc435f551dca3094286ae
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 5 Dec 2022 13:37:41 +0000 (5 14:37 +0100)
committerPratyush Yadav <me@yadavpratyush.com>
Tue, 24 Jan 2023 13:10:40 +0000 (24 14:10 +0100)
tree2f1802b4c23d4c01d0adf541c41c826fd77f64e4
parente0539b4b25310e242d30b91a2c86f5e7a30aade6
Move the `_which` function (almost) to the top

We are about to make use of the `_which` function to address
CVE-2022-41953 by overriding Tcl/Tk's unsafe PATH lookup on Windows.

In preparation for that, let's move it close to the top of the file to
make sure that even early `exec` calls that happen during the start-up
of Git GUI benefit from the fix.

This commit is best viewed with `--color-moved`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
git-gui.sh