Skip to content

Commit

Permalink
aliases: Do not allow mix of git-omz and git
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gorny committed Sep 17, 2021
1 parent 6bc9ce2 commit 9eceb42
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions aliases/available/git-omz.aliases.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'git aliases from oh-my-zsh'
about-alias 'git aliases from oh-my-zsh (incompatible with regular git aliases option)'

# We are not vendoring this, as we need to adapt it to bash :(
if [[ -n $_bash_it_git_aliases_enabled ]]; then
_log_error "git-omz aliases are incompatible with regular git aliases"
return
fi

# Load after regular git aliases
# BASH_IT_LOAD_PRIORITY: 160
Expand Down
3 changes: 3 additions & 0 deletions aliases/available/git.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
cite 'about-alias'
about-alias 'common git abbreviations'

# We can use this variable to make sure that we don't accidentally clash with git-zsh aliases
_bash_it_git_aliases_enabled=true

alias g='git'
alias get='git'

Expand Down
9 changes: 8 additions & 1 deletion test/lib/search.bats
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ function local_teardown {

@test "search: git" {
run _bash-it-search 'git' --no-color
assert_line -n 0 ' aliases: git gitsvn '

assert_line -n 0 -p ' aliases:'
for alias in 'git' 'gitsvn' 'git-omz'
do
echo $alias
assert_line -n 0 -p $alias
done

assert_line -n 1 -p ' plugins:'
for plugin in "autojump" "git" "gitstatus" "git-subrepo" "jgitflow" "jump"
do
Expand Down

0 comments on commit 9eceb42

Please sign in to comment.