Skip to content

Commit 9928079

Browse files
authored
Merge pull request #11 from DiamondLightSource/git-editor
Add GIT_EDITOR
2 parents d6ecb94 + bd52fb5 commit 9928079

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.devcontainer/features/bash-config/config/bash-config-rc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ __bash_prompt() {
3636
__bash_prompt
3737
export PROMPT_DIRTRIM=4
3838

39+
# Set the default git editor if not already set
40+
# from https://github.com/devcontainers/features/blob/f8e7e275b7ba2808e14a035afd753b83be68e2d9/src/common-utils/scripts/rc_snippet.sh
41+
if [ -z "$(git config --get core.editor)" ] && [ -z "${GIT_EDITOR}" ]; then
42+
if [ "${TERM_PROGRAM}" = "vscode" ]; then
43+
if [[ -n $(command -v code-insiders) && -z $(command -v code) ]]; then
44+
export GIT_EDITOR="code-insiders --wait"
45+
else
46+
export GIT_EDITOR="code --wait"
47+
fi
48+
fi
49+
fi
50+
3951
# colorize ls output
4052
export LS_OPTIONS='--color=auto'
4153
eval "$(dircolors)"

test/bash-config/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ source dev-container-features-test-lib
1010
# Feature-specific tests
1111
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
1212
# check <LABEL> <cmd> [args...]
13+
check "eternal history" bash -c "test $HISTFILE == $CONFIG_FOLDER/.bash_eternal_history"
1314
check "execute command" bash -c "test $HISTFILE == $CONFIG_FOLDER/.bash_eternal_history"
1415
check "ls colors" bash -c "test $LS_OPTIONS == --color=auto"
1516

0 commit comments

Comments
 (0)