Merge branch 'master' of git://github.com/ndbroadbent/scm_breeze

This commit is contained in:
Aljaž "g5pw" Srebrnič
2013-08-20 21:54:04 +02:00
7 changed files with 25 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ 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
checkout|commit|rm|blame|diff|add|log|rebase)
checkout|commit|rm|blame|diff|add|log|rebase|reset)
exec_scmb_expand_args "$_git_cmd" "$@";;
branch)
_scmb_git_branch_shortcuts "${@:2}";;
@@ -97,6 +97,8 @@ if [ "$git_setup_aliases" = "yes" ]; then
__git_alias "$git_diff_word_alias" "git" "diff" "--word-diff"
__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"
# 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"
__git_alias "$git_log_alias" "git" "$git_log_command"
@@ -117,10 +119,14 @@ if [ "$git_setup_aliases" = "yes" ]; then
__git_alias "$git_rebase_interactive_alias" "git" 'rebase' "-i"
__git_alias "$git_rebase_alias_continue" "git" 'rebase' "--continue"
__git_alias "$git_rebase_alias_abort" "git" 'rebase' "--abort"
__git_alias "$git_reset_last_commit" "git" "reset HEAD~"
__git_alias "$git_merge_alias" "git" 'merge'
__git_alias "$git_cherry_pick_alias" "git" 'cherry-pick'
__git_alias "$git_show_alias" "git" 'show'
__git_alias "$git_show_summary" "git" 'show' '--summary'
__git_alias "$git_stash_alias" "git" 'stash'
__git_alias "$git_stash_apply_alias" "git" 'stash' 'apply'
__git_alias "$git_stash_list_alias" "git" 'stash' 'list'
__git_alias "$git_tag_alias" "git" 'tag'
@@ -143,6 +149,8 @@ fi
if [ $shell = "bash" ]; then
# Fix to preload Arch bash completion for git
[[ -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
# Git repo management & aliases.

View File

@@ -15,7 +15,7 @@ function _scmb_git_branch_shortcuts {
fail_if_not_git_repo || return 1
# Fall back to normal git branch, if any unknown args given
if [[ -n "$@" ]] && [[ "$@" != "-a" ]]; then
$_git_cmd branch "$@"
exec_scmb_expand_args $_git_cmd branch "$@"
return 1
fi

View File

@@ -97,9 +97,9 @@ function git_index() {
fi
# Try partial matches
# - string at beginning of project
if [ -z "$base_path" ]; then base_path=$(_git_index_dirs_without_home | \grep -m1 "/$project"); fi
if [ -z "$base_path" ]; then base_path=$(_git_index_dirs_without_home | \grep -m1 -i "/$project"); fi
# - string anywhere in project
if [ -z "$base_path" ]; then base_path=$(_git_index_dirs_without_home | \grep -m1 "$project"); fi
if [ -z "$base_path" ]; then base_path=$(_git_index_dirs_without_home | \grep -m1 -i "$project"); fi
# --------------------
# Go to our base path
if [ -n "$base_path" ]; then

View File

@@ -20,7 +20,7 @@
# # groups => 1: staged, 2: unmerged, 3: unstaged, 4: untracked
# --------------------------------------------------------------------
@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --git-dir 2> /dev/null`.sub(/\/\.git$/, '').strip
@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --show-toplevel 2> /dev/null`.strip
@git_status = `\git status --porcelain 2> /dev/null`

View File

@@ -119,9 +119,9 @@ scmb_expand_args() {
first=1
OLDIFS="$IFS"; IFS=" " # We need to split on spaces to loop over expanded range
for arg in "$@"; do
if [[ "$arg" =~ ^[0-9]+$ ]] ; then # Substitute $e{*} variables for any integers
if [[ "$arg" =~ ^[0-9]{0,4}$ ]] ; then # Substitute $e{*} variables for any integers
if [ "$first" -eq 1 ]; then first=0; else printf '\t'; fi
if [ -e "$arg" ]; then
if [ -e "$arg" ]; then
printf '%s' "$arg"
else
eval printf '%s' "\"\$$git_env_char$arg\""
@@ -210,7 +210,7 @@ git_commit_prompt() {
# Prompt for commit message, then commit all modified and untracked files.
git_commit_all() {
fail_if_not_git_repo || return 1
changes=$(git status --porcelain | wc -l)
changes=$(git status --porcelain | wc -l | tr -d ' ')
if [ "$changes" -gt 0 ]; then
if [ -n "$APPEND" ]; then
local appending=" | \033[0;36mappending '\033[1;36m$APPEND\033[0;36m' to commit message.\033[0m"