Skip to content

Commit

Permalink
Setting default GIT configuration as test/ being HOME during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spog committed Nov 17, 2024
1 parent e4f529e commit 11af447
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/git-subrepo
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ assert-repo-is-ready() {
[[ $command =~ ^(help|version|upgrade)$ ]] && return

# We must be inside a git repo:
git rev-parse --git-dir &> /dev/null ||
git rev-parse --is-inside-git-dir &> /dev/null ||
error "Not inside a git repository."

# Get the original branch and commit:
Expand Down
11 changes: 11 additions & 0 deletions test/setup
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ fi
export XDG_CONFIG_HOME=$SCRIPT_DIR
export HOME=$SCRIPT_DIR
export GIT_CONFIG_NOSYSTEM=1
# Set global GIT configuration for tests:
if [ ! -f "${HOME}/.gitconfig" ]; then
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global init.defaultBranch "master"
git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "$(pwd)/.git"
if ! git symbolic-ref --short --quiet HEAD; then
git checkout -b test
fi
fi
# To be able to view current GIT confirguration during tests execution,
# run the test suite by adding the '-v' option to the prove command.
git config --list
Expand Down

0 comments on commit 11af447

Please sign in to comment.