merge upstream/master
This commit is contained in:
@@ -17,7 +17,7 @@ unalias git > /dev/null 2>&1
|
||||
unset -f git > /dev/null 2>&1
|
||||
|
||||
# Use the full path to git to avoid infinite loop with git function
|
||||
export _git_cmd="$(\which git)"
|
||||
export _git_cmd="$(bin_path git)"
|
||||
# Wrap git with the 'hub' github wrapper, if installed (https://github.com/defunkt/hub)
|
||||
if type hub > /dev/null 2>&1; then export _git_cmd="hub"; fi
|
||||
|
||||
@@ -28,9 +28,9 @@ if type hub > /dev/null 2>&1; then export _git_cmd="hub"; fi
|
||||
function git(){
|
||||
# Only expand args for git commands that deal with paths or branches
|
||||
case $1 in
|
||||
commit|blame|add|log|rebase|merge|difftool)
|
||||
commit|blame|add|log|rebase|merge|difftool|switch)
|
||||
exec_scmb_expand_args "$_git_cmd" "$@";;
|
||||
checkout|diff|rm|reset)
|
||||
checkout|diff|rm|reset|restore)
|
||||
exec_scmb_expand_args --relative "$_git_cmd" "$@";;
|
||||
branch)
|
||||
_scmb_git_branch_shortcuts "${@:2}";;
|
||||
@@ -57,7 +57,7 @@ let COMP_CWORD+=1
|
||||
|
||||
local cur words cword prev
|
||||
_get_comp_words_by_ref -n =: cur words cword prev
|
||||
_git
|
||||
__git_wrap__git_main
|
||||
}
|
||||
"
|
||||
}
|
||||
@@ -71,7 +71,7 @@ __git_alias () {
|
||||
alias_str="$1"; cmd_prefix="$2"; cmd="$3";
|
||||
if [ $# -gt 2 ]; then
|
||||
shift 3 2>/dev/null
|
||||
cmd_args=$@
|
||||
cmd_args=("$@")
|
||||
fi
|
||||
|
||||
alias $alias_str="$cmd_prefix $cmd${cmd_args:+ }${cmd_args[*]}"
|
||||
@@ -89,6 +89,7 @@ _alias "$git_add_shortcuts_alias" 'git_add_shortcuts'
|
||||
_alias "$exec_scmb_expand_args_alias" 'exec_scmb_expand_args'
|
||||
_alias "$git_show_files_alias" 'git_show_affected_files'
|
||||
_alias "$git_commit_all_alias" 'git_commit_all'
|
||||
_alias "$git_grep_shortcuts_alias" 'git_grep_shortcuts'
|
||||
|
||||
# Git Index alias
|
||||
_alias "$git_index_alias" 'git_index'
|
||||
@@ -100,21 +101,23 @@ if [ "$git_setup_aliases" = "yes" ]; then
|
||||
__git_alias "$git_checkout_alias" 'git' 'checkout'
|
||||
__git_alias "$git_commit_alias" 'git' 'commit'
|
||||
__git_alias "$git_commit_verbose_alias" 'git' 'commit' '--verbose'
|
||||
__git_alias "$git_reset_alias" 'git' 'reset' '--'
|
||||
__git_alias "$git_reset_alias" 'git' 'reset'
|
||||
__git_alias "$git_reset_hard_alias" 'git' 'reset' '--hard'
|
||||
__git_alias "$git_rm_alias" 'git' 'rm'
|
||||
__git_alias "$git_blame_alias" 'git' 'blame'
|
||||
__git_alias "$git_diff_no_whitespace_alias" 'git' 'diff' '-w' '--'
|
||||
__git_alias "$git_diff_no_whitespace_alias" 'git' 'diff' '-w'
|
||||
__git_alias "$git_diff_alias" 'git' 'diff'
|
||||
__git_alias "$git_diff_file_alias" 'git' 'diff' '--'
|
||||
__git_alias "$git_diff_file_alias" 'git' 'diff'
|
||||
__git_alias "$git_diff_word_alias" 'git' 'diff' '--word-diff'
|
||||
__git_alias "$git_diff_cached_alias" 'git' 'diff' '--cached --'
|
||||
__git_alias "$git_diff_cached_alias" 'git' 'diff' '--cached'
|
||||
__git_alias "$git_add_patch_alias" 'git' 'add' '-p'
|
||||
__git_alias "$git_add_updated_alias" 'git' 'add' '-u'
|
||||
__git_alias "$git_difftool_alias" 'git' 'difftool'
|
||||
__git_alias "$git_difftool_meld_alias" 'git' 'difftool -y -t meld'
|
||||
__git_alias "$git_difftool_vimdiff_alias" 'git' 'difftool -y -t vimdiff'
|
||||
__git_alias "$git_difftool_gvimdiff_alias" 'git' 'difftool -y -t gvimdiff'
|
||||
__git_alias "$git_mergetool_alias" 'git' 'mergetool'
|
||||
__git_alias "$git_restore_alias" 'git' 'restore'
|
||||
|
||||
# Custom default format for git log
|
||||
git_log_command="log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
@@ -157,6 +160,7 @@ if [ "$git_setup_aliases" = "yes" ]; then
|
||||
__git_alias "$git_submodule_update_rec_alias" 'git' 'submodule' 'update' '--init' '--recursive'
|
||||
__git_alias "$git_whatchanged_alias" 'git' 'whatchanged'
|
||||
__git_alias "$git_apply_alias" 'git' 'apply'
|
||||
__git_alias "$git_switch_alias" 'git' 'switch'
|
||||
|
||||
# Compound/complex commands
|
||||
_alias "$git_fetch_all_alias" 'git fetch --all'
|
||||
@@ -184,7 +188,7 @@ if [ $shell = "bash" ]; then
|
||||
[[ -s "/usr/share/git/completion/git-completion.bash" ]] && source "/usr/share/git/completion/git-completion.bash"
|
||||
# new path in Ubuntu 13.04
|
||||
[[ -s "/usr/share/bash-completion/completions/git" ]] && source "/usr/share/bash-completion/completions/git"
|
||||
complete -o default -o nospace -F _git $git_alias
|
||||
complete -o default -o nospace -F __git_wrap__git_main $git_alias
|
||||
|
||||
# Git repo management & aliases.
|
||||
# If you know how to rewrite _git_index_tab_completion() for zsh, please send me a pull request!
|
||||
|
||||
Reference in New Issue
Block a user