Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Florian Tham
2017-10-02 23:01:43 +02:00
11 changed files with 60 additions and 30 deletions

View File

@@ -1,8 +1,6 @@
# Now looking for help with maintainance. <img src="https://user-images.githubusercontent.com/139536/30827652-08e9b684-a265-11e7-95fb-50cbd2fb7c0d.png" width="200" height="200">
## Please post an issue if you would like to help out.
---
# SCM Breeze [![TravisCI](https://secure.travis-ci.org/scmbreeze/scm_breeze.png?branch=master)](http://travis-ci.org/scmbreeze/scm_breeze) # SCM Breeze [![TravisCI](https://secure.travis-ci.org/scmbreeze/scm_breeze.png?branch=master)](http://travis-ci.org/scmbreeze/scm_breeze)

View File

@@ -102,5 +102,6 @@ design() {
printf "Invalid command.\n\n" printf "Invalid command.\n\n"
design design
fi fi
unset IFS
} }

View File

@@ -33,11 +33,13 @@ EOF
# Set numbered file shortcut in variable # Set numbered file shortcut in variable
local e=1 local e=1
IFS=$'\n'
for branch in $($_git_cmd branch "$@" | sed "s/^[* ]\{2\}//"); do for branch in $($_git_cmd branch "$@" | sed "s/^[* ]\{2\}//"); do
export $git_env_char$e="$branch" export $git_env_char$e="$branch"
if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi
let e++ let e++
done done
unset IFS
} }
__git_alias "$git_branch_alias" "_scmb_git_branch_shortcuts" "" __git_alias "$git_branch_alias" "_scmb_git_branch_shortcuts" ""

View File

@@ -114,7 +114,7 @@ git_status_shortcuts() {
# so just use plain 'git status' # so just use plain 'git status'
git status git status
fi fi
IFS=$' \t\n' unset IFS
zsh_reset # Reset zsh environment to default zsh_reset # Reset zsh environment to default
} }
# Template function for 'git_status_shortcuts'. # Template function for 'git_status_shortcuts'.

View File

@@ -32,8 +32,8 @@ if [[ "$git_keyboard_shortcuts_enabled" = "true" ]]; then
_bind "$git_commit_all_with_ci_skip_keys" " \033[1~ APPEND='[ci skip]' git_commit_all ""\n" _bind "$git_commit_all_with_ci_skip_keys" " \033[1~ APPEND='[ci skip]' git_commit_all ""\n"
else else
_bind "$git_commit_all_keys" "\" git_commit_all\n\"" _bind "$git_commit_all_keys" "\" git_commit_all\n\""
_bind "$git_add_and_commit_keys" "\"\033[1~ git_add_and_commit \n\"" _bind "$git_add_and_commit_keys" "\"\C-A git_add_and_commit \n\""
_bind "$git_commit_all_with_ci_skip_keys" "\"\033[1~ APPEND='[ci skip]' git_commit_all \n\"" _bind "$git_commit_all_with_ci_skip_keys" "\"\C-A APPEND='[ci skip]' git_commit_all \n\""
fi fi
fi fi

View File

@@ -116,7 +116,7 @@ function git_index() {
fi fi
fi fi
fi fi
IFS=$' \t\n' unset IFS
} }
_git_index_dirs_without_home() { _git_index_dirs_without_home() {
@@ -131,7 +131,7 @@ function _find_git_repos() {
echo ${repo%/.git} # Return project folder, with trailing ':' echo ${repo%/.git} # Return project folder, with trailing ':'
_find_git_submodules $repo # Detect any submodules _find_git_submodules $repo # Detect any submodules
done done
IFS=$' \t\n' unset IFS
} }
# List all submodules for a git repo, if any. # List all submodules for a git repo, if any.
@@ -150,7 +150,7 @@ function _rebuild_git_index() {
for repo in $(echo -e "$(_find_git_repos)\n$(echo $GIT_REPOS | sed "s/:/\\\\n/g")"); do for repo in $(echo -e "$(_find_git_repos)\n$(echo $GIT_REPOS | sed "s/:/\\\\n/g")"); do
echo $(basename $repo | sed "s/ /_/g") $repo echo $(basename $repo | sed "s/ /_/g") $repo
done | sort | cut -d " " -f2- >| "$GIT_REPO_DIR/.git_index" done | sort | cut -d " " -f2- >| "$GIT_REPO_DIR/.git_index"
IFS=$' \t\n' unset IFS
if [ "$1" != "--silent" ]; then if [ "$1" != "--silent" ]; then
echo -e "===== Indexed $_bld_col$(_git_index_count)$_txt_col repos in $GIT_REPO_DIR/.git_index" echo -e "===== Indexed $_bld_col$(_git_index_count)$_txt_col repos in $GIT_REPO_DIR/.git_index"
@@ -225,7 +225,7 @@ _git_index_update_all_branches() {
echo "=== Skipping $branch: remote and merge refs are not configured." echo "=== Skipping $branch: remote and merge refs are not configured."
fi fi
done done
IFS=$' \t\n' unset IFS
# Update all remotes if there are any branches to update # Update all remotes if there are any branches to update
if [ -n "${branches[*]}" ]; then git fetch --all 2> /dev/null; fi if [ -n "${branches[*]}" ]; then git fetch --all 2> /dev/null; fi
@@ -268,7 +268,7 @@ function _git_index_batch_cmd() {
cwd="$PWD" cwd="$PWD"
if [ -n "$1" ]; then if [ -n "$1" ]; then
echo -e "== Running command for $_bld_col$(_git_index_count)$_txt_col repos...\n" echo -e "== Running command for $_bld_col$(_git_index_count)$_txt_col repos...\n"
IFS=$' \t\n' unset IFS
local base_path local base_path
for base_path in $(sed -e "s/--.*//" "$GIT_REPO_DIR/.git_index" | \grep . | sort); do for base_path in $(sed -e "s/--.*//" "$GIT_REPO_DIR/.git_index" | \grep . | sort); do
builtin cd "$base_path" builtin cd "$base_path"
@@ -313,7 +313,7 @@ if [ $shell = 'bash' ]; then
else else
COMPREPLY=($(compgen -W '$(sed -e "s:.*/::" -e "s:$:/:" "$GIT_REPO_DIR/.git_index" | sort)' -- $curw)) COMPREPLY=($(compgen -W '$(sed -e "s:.*/::" -e "s:$:/:" "$GIT_REPO_DIR/.git_index" | sort)' -- $curw))
fi fi
IFS=$' \t\n' unset IFS
return 0 return 0
} }
else else

View File

@@ -125,11 +125,11 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && which ruby > /dev/null 2>&1; then
fi fi
# Parse path from args # Parse path from args
OLDIFS="$IFS"; IFS=$'\n' IFS=$'\n'
for arg in $@; do for arg in $@; do
if [ -d "$arg" ]; then local rel_path="${arg%/}"; fi if [ -d "$arg" ]; then local rel_path="${arg%/}"; fi
done done
IFS="$OLDIFS" unset IFS
# Replace user/group with user symbol, if defined at ~/.user_sym # Replace user/group with user symbol, if defined at ~/.user_sym
# Before : -rw-rw-r-- 1 ndbroadbent ndbroadbent 1.1K Sep 19 21:39 scm_breeze.sh # Before : -rw-rw-r-- 1 ndbroadbent ndbroadbent 1.1K Sep 19 21:39 scm_breeze.sh
@@ -175,14 +175,14 @@ EOF
ll_files="$(\ls "$@")" ll_files="$(\ls "$@")"
fi fi
OLDIFS="$IFS"; IFS=$'\n' IFS=$'\n'
for file in $ll_files; do for file in $ll_files; do
if [ -n "$rel_path" ]; then file="$rel_path/$file"; fi if [ -n "$rel_path" ]; then file="$rel_path/$file"; fi
export $git_env_char$e="$(eval $_abs_path_command \"${file//\"/\\\"}\")" export $git_env_char$e="$(eval $_abs_path_command \"${file//\"/\\\"}\")"
if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi
let e++ let e++
done done
IFS="$OLDIFS" unset IFS
# Turn off shwordsplit unless it was on previously # Turn off shwordsplit unless it was on previously
if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi

View File

@@ -43,7 +43,7 @@ git_status_shortcuts() {
if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi
let e++ let e++
done done
IFS=$' \t\n' unset IFS
if [ "${scmbDebug:-}" = "true" ]; then echo "------------------------"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "------------------------"; fi
# Print status # Print status
@@ -91,7 +91,7 @@ git_silent_add_shortcuts() {
echo -e "# Added '$file'" echo -e "# Added '$file'"
fi fi
done done
IFS=$' \t\n' unset IFS
echo "#" echo "#"
fi fi
} }
@@ -186,7 +186,7 @@ _git_resolve_merge_conflict() {
git add "$file" git add "$file"
echo -e "# Added $1 version of '$file'" echo -e "# Added $1 version of '$file'"
done done
IFS=$' \t\n' unset IFS
echo -e "# -- If you have finished resolving conflicts, commit the resolutions with 'git commit'" echo -e "# -- If you have finished resolving conflicts, commit the resolutions with 'git commit'"
fi fi
} }

25
scm_breeze.plugin.zsh Normal file
View File

@@ -0,0 +1,25 @@
#########################################################
# Forked from http://github.com/ndbroadbent/scm_breeze #
# #
# File Copied and modified from ./install.sh #
# to be compatible with oh-my-zsh's plugin system #
#########################################################
#!/bin/bash
#locate the dir where this script is stored
export scmbDir="$( cd -P "$( dirname "$0" )" && pwd )"
# Symlink to ~/.scm_breeze if installing from another path
if [ ! -s "$HOME/.scm_breeze" ] && [ "$scmbDir" != "$HOME/.scm_breeze" ]; then
ln -fs "$scmbDir" "$HOME/.scm_breeze"
# Load SCM Breeze update scripts
source "$scmbDir/lib/scm_breeze.sh"
# Create '~/.*.scmbrc' files from example files
_create_or_patch_scmbrc
fi
# This loads SCM Breeze into the shell session.
[ -s "$HOME/.scm_breeze/scm_breeze.sh" ] && source "$HOME/.scm_breeze/scm_breeze.sh"

View File

@@ -63,7 +63,7 @@ EOF
for dir in $GIT_REPOS; do for dir in $GIT_REPOS; do
mkdir -p $dir; cd $dir; git init; mkdir -p $dir; cd $dir; git init;
done done
IFS=$' \t\n' unset IFS
verboseGitCommands verboseGitCommands
@@ -74,7 +74,7 @@ oneTimeTearDown() {
rm -rf "${GIT_REPO_DIR}" rm -rf "${GIT_REPO_DIR}"
IFS=":" IFS=":"
for dir in $GIT_REPOS; do rm -rf $dir; done for dir in $GIT_REPOS; do rm -rf $dir; done
IFS=$' \t\n' unset IFS
} }
ensureIndex() { ensureIndex() {

View File

@@ -33,11 +33,15 @@ oneTimeSetUp() {
# Test functions # Test functions
function ln() { ln $@; } function ln() { ln $@; }
# Test aliases # Test aliases
alias mv="nocorrect mv" export mv_path="$(which mv)"
alias rm="rm --option" export rm_path="$(which rm)"
alias sed="sed" export sed_path="$(which sed)"
export cat_pathj="$(which cat)"
alias mv="nocorrect $mv_path"
alias rm="$rm_path --option"
alias sed="$sed_path"
# Test already wrapped commands # Test already wrapped commands
alias cat="exec_scmb_expand_args /bin/cat" alias cat="exec_scmb_expand_args $cat_path"
# Run shortcut wrapping # Run shortcut wrapping
source "$scmbDir/lib/git/shell_shortcuts.sh" source "$scmbDir/lib/git/shell_shortcuts.sh"
@@ -59,10 +63,10 @@ assertAliasEquals(){
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
test_shell_command_wrapping() { test_shell_command_wrapping() {
assertAliasEquals "exec_scmb_expand_args /bin/rm --option" "rm" assertAliasEquals "exec_scmb_expand_args $rm_path --option" "rm"
assertAliasEquals "exec_scmb_expand_args nocorrect /bin/mv" "mv" assertAliasEquals "exec_scmb_expand_args nocorrect $mv_path" "mv"
assertAliasEquals "exec_scmb_expand_args /bin/sed" "sed" assertAliasEquals "exec_scmb_expand_args $sed_path" "sed"
assertAliasEquals "exec_scmb_expand_args /bin/cat" "cat" assertAliasEquals "exec_scmb_expand_args $cat_path" "cat"
assertAliasEquals "exec_scmb_expand_args builtin cd" "cd" assertAliasEquals "exec_scmb_expand_args builtin cd" "cd"
assertIncludes "$(declare -f ln)" "ln ()" assertIncludes "$(declare -f ln)" "ln ()"
assertIncludes "$(declare -f ln)" "exec_scmb_expand_args __original_ln" assertIncludes "$(declare -f ln)" "exec_scmb_expand_args __original_ln"