#!/usr/bin/env bash

# SPDX-FileCopyrightText: 2026 Romain Maneschi <romain@gitroot.dev>
#
# SPDX-License-Identifier: EUPL-1.2

MY_LOG=${MY_LOG:-"/tmp/mylog.txt"}

_init() {
    local SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
}

_init
unset -f _init

# quiet_git <cmd>...
#   Like git but redirect stdout to $MY_LOG file
function quiet_git() {
    echo "🚀 git $@" >> $MY_LOG
    GIT_TRACE=false GIT_TRACE_PACKET=false git "$@" &>> $MY_LOG
}