Skip to content

Commit

Permalink
Add GIT_EDITOR
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Dec 20, 2024
1 parent 18a60ce commit 7c3615a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .devcontainer/features/bash-config/config/bash-config-rc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ __bash_prompt() {
__bash_prompt
export PROMPT_DIRTRIM=4

# Set the default git editor if not already set
# from https://github.com/devcontainers/features/blob/f8e7e275b7ba2808e14a035afd753b83be68e2d9/src/common-utils/scripts/rc_snippet.sh
if [ -z "$(git config --get core.editor)" ] && [ -z "${GIT_EDITOR}" ]; then
if [ "${TERM_PROGRAM}" = "vscode" ]; then
if [[ -n $(command -v code-insiders) && -z $(command -v code) ]]; then
export GIT_EDITOR="code-insiders --wait"
else
export GIT_EDITOR="code --wait"
fi
fi
fi

# enable bash completion for git
if [[ -f /usr/share/bash-completion/completions/git ]]; then
source /usr/share/bash-completion/completions/git
Expand Down
2 changes: 1 addition & 1 deletion test/bash-config/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source dev-container-features-test-lib
# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
# check <LABEL> <cmd> [args...]
check "execute command" bash -c "test $HISTFILE == $CONFIG_FOLDER/.bash_eternal_history"
check "eternal history" bash -c "test $HISTFILE == $CONFIG_FOLDER/.bash_eternal_history"

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
Expand Down

0 comments on commit 7c3615a

Please sign in to comment.