#!/bin/bash -e

# When your mac has not git installed, running a git command will trigger a popup asking you to install git.
# The backend uses jgit and should not need git installed on your machine (appart when using exotic commands...)
# This file mitigates the fact that jgit tries to run `git --version` pretty often.
# basically, we return 1 if calling git --version and for ny other command, we call the real git

MYDIR=$(cd "$(dirname "$0")" && pwd -P)

if [[ $# -ne 0 && $@ == "--version" ]]; then
    exit 1
fi

# This will clean the path
export PATH=${PATH//"$MYDIR:"/""}
export PATH=${PATH//":$MYDIR"/""}

git "$@"
