# 1. --venv-file <path/to/file> as lf_venv
# 2. default: "/tmp/.os_lf_venv"
# - Create new venv when 1. and 2. is absent
- if [ -f "$venv_file" ]; then
+ if [[ -f "$venv_file" ]]; then
lf_venv=$(cat "$venv_file")
echo "${FUNCNAME[0]}(): INFO: Reuse venv:$lf_venv from" \
"file:$venv_file"
- elif [ ! -f "$venv_file" ]; then
- $python -m venv "$install_args" "$lf_venv" || return 1
+ elif [[ ! -f "$venv_file" ]]; then
+ if [[ -n "$install_args" ]]; then
+ $python -m venv "$install_args" "$lf_venv" || return 1
+ else
+ $python -m venv "$lf_venv" || return 1
+ fi
echo "${FUNCNAME[0]}(): INFO: Creating $python venv at $lf_venv"
echo "$lf_venv" > "$venv_file"
echo "${FUNCNAME[0]}(): INFO: Save venv in file: $venv_file"
--- /dev/null
+---
+issues:
+ - |
+ git-review tries to copy commit-msg hook to submodules with incorrect
+ source file path (.git/hooks/commit-msg) and fails - the path should
+ be ../.git/hooks/commit-msg if a relative path is used since the copy
+ command is run in the submodule directory
+ - |
+ lf-activate-venv creates a virtual environment in the current working
+ directory where lf-activate-venv is run. This clutters the repository
+ and all the files for the virtual environment are added for update.
+
+fixes:
+ - |
+ Set 'core.hooksPath' with the absolute path of the top-level hooks directory
+ so that the correct source path can be used regardless of the working directory.
+ - |
+ Use the correct command depending on the $install_args value to avoid
+ creating an additional virtual environment in the current working directory.
# If the reviewers email is unset/empty then use a default
reviewers_email=${REVIEWERS_EMAIL:-"$GERRIT_USER@$GERRIT_HOST"}
+# Workaround for git-review failing to copy the commit-msg hook to submodules
+git config core.hooksPath "$(git rev-parse --show-toplevel)/.git/hooks"
+
git review --yes -t "$GERRIT_TOPIC" --reviewers "$reviewers_email"