Merge branch 'master' of git://github.com/ndbroadbent/scm_breeze
This commit is contained in:
@@ -35,6 +35,7 @@ git_alias="g"
|
||||
git_status_shortcuts_alias="gs"
|
||||
git_add_shortcuts_alias="ga"
|
||||
git_add_patch_alias="gap"
|
||||
git_add_updated_alias="gau"
|
||||
git_show_files_alias="gsf"
|
||||
exec_scmb_expand_args_alias="ge"
|
||||
# 2. Commands that handle paths (with shortcut args expanded)
|
||||
@@ -49,6 +50,7 @@ git_blame_alias="gbl"
|
||||
git_diff_alias="gd"
|
||||
git_diff_word_alias="gdw"
|
||||
git_diff_cached_alias="gdc"
|
||||
git_difftool_alias="gdt"
|
||||
# 3. Standard commands
|
||||
git_clone_alias="gcl"
|
||||
git_fetch_alias="gf"
|
||||
@@ -77,6 +79,7 @@ git_rebase_alias="grb"
|
||||
git_rebase_interactive_alias="grbi"
|
||||
git_rebase_alias_continue="grbc"
|
||||
git_rebase_alias_abort="grba"
|
||||
git_reset_last_commit="grsl"
|
||||
git_merge_alias="gm"
|
||||
git_cherry_pick_alias="gcp"
|
||||
git_log_alias="gl"
|
||||
@@ -84,6 +87,9 @@ git_log_stat_alias="gls"
|
||||
git_log_graph_alias="glg"
|
||||
git_show_alias="gsh"
|
||||
git_show_summary="gsm" # (gss taken by git status short)
|
||||
git_stash_alias="gash"
|
||||
git_stash_apply_alias="gasha"
|
||||
git_stash_list_alias="gashl"
|
||||
git_tag_alias="gt"
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ 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
|
||||
printf '%s' "$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"
|
||||
|
||||
@@ -33,7 +33,7 @@ oneTimeSetUp() {
|
||||
|
||||
cd $GIT_REPO_DIR
|
||||
# Setup test repos in temp repo dir
|
||||
for repo in github bitbucket source_forge; do
|
||||
for repo in github bitbucket source_forge TestCaps; do
|
||||
mkdir $repo; cd $repo; git init; cd - > /dev/null
|
||||
done
|
||||
|
||||
@@ -119,7 +119,7 @@ test_check_git_index() {
|
||||
}
|
||||
|
||||
test_git_index_count() {
|
||||
assertEquals "9" "$(_git_index_count)"
|
||||
assertEquals "10" "$(_git_index_count)"
|
||||
}
|
||||
|
||||
test_repo_list() {
|
||||
@@ -136,6 +136,7 @@ test_git_index_changing_directory() {
|
||||
git_index "github"; assertEquals "$GIT_REPO_DIR/github" "$PWD"
|
||||
git_index "github/"; assertEquals "$GIT_REPO_DIR/github" "$PWD"
|
||||
git_index "bucket"; assertEquals "$GIT_REPO_DIR/bitbucket" "$PWD"
|
||||
git_index "testcaps"; assertEquals "$GIT_REPO_DIR/TestCaps" "$PWD"
|
||||
git_index "green_sub"; assertEquals "$GIT_REPO_DIR/submodules_everywhere/very/nested/directory/green_submodule" "$PWD"
|
||||
git_index "_submod"; assertEquals "$GIT_REPO_DIR/submodules_everywhere/very/nested/directory/blue_submodule" "$PWD"
|
||||
git_index "test_repo_1"; assertEquals "/tmp/test_repo_1" "$PWD"
|
||||
|
||||
Reference in New Issue
Block a user