From 6860d114fc481baf25cc66377ade432154c571a3 Mon Sep 17 00:00:00 2001 From: David Lee Date: Fri, 20 Dec 2013 00:30:52 -0800 Subject: [PATCH 1/9] Fix shortcuts offset when branch_shortcuts encounters detached HEAD (fixes #127) --- lib/git/branch_shortcuts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/git/branch_shortcuts.sh b/lib/git/branch_shortcuts.sh index 1e933b9..9a7e94a 100644 --- a/lib/git/branch_shortcuts.sh +++ b/lib/git/branch_shortcuts.sh @@ -32,6 +32,7 @@ EOF # Set numbered file shortcut in variable local e=1 + IFS=$'\n' for branch in $($_git_cmd branch "$@" | sed "s/^[* ]\{2\}//"); do export $git_env_char$e="$branch" if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi From 455239f59406ca39ab731812867a23b23001b218 Mon Sep 17 00:00:00 2001 From: Martino Visintin Date: Fri, 27 Jan 2017 21:41:50 +0000 Subject: [PATCH 2/9] make tests independent of bin locations On my system (Arch Linux), the commands {mv,rm,sed} live under `/usr/bin`, not under `/bin`. So the tests were failing. This commit hard-codes the initial paths to make the tests independent on their real paths. --- test/lib/git/shell_shortcuts_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/lib/git/shell_shortcuts_test.sh b/test/lib/git/shell_shortcuts_test.sh index b826a0b..76d23fd 100755 --- a/test/lib/git/shell_shortcuts_test.sh +++ b/test/lib/git/shell_shortcuts_test.sh @@ -33,9 +33,9 @@ oneTimeSetUp() { # Test functions function ln() { ln $@; } # Test aliases - alias mv="nocorrect mv" - alias rm="rm --option" - alias sed="sed" + alias mv="nocorrect /bin/mv" + alias rm="/bin/rm --option" + alias sed="/bin/sed" # Test already wrapped commands alias cat="exec_scmb_expand_args /bin/cat" From 6f4babeced9b283b3a2d842cbb967d0ca4a0af24 Mon Sep 17 00:00:00 2001 From: Wilhelmina Drengwitz Date: Tue, 31 Jan 2017 15:50:14 -0500 Subject: [PATCH 3/9] Extend tests to use conditional exe paths --- test/lib/git/shell_shortcuts_test.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/lib/git/shell_shortcuts_test.sh b/test/lib/git/shell_shortcuts_test.sh index 76d23fd..522b586 100755 --- a/test/lib/git/shell_shortcuts_test.sh +++ b/test/lib/git/shell_shortcuts_test.sh @@ -33,11 +33,11 @@ oneTimeSetUp() { # Test functions function ln() { ln $@; } # Test aliases - alias mv="nocorrect /bin/mv" - alias rm="/bin/rm --option" - alias sed="/bin/sed" + alias mv="nocorrect $(which mv)" + alias rm="$(which rm) --option" + alias sed="$(which sed)" # Test already wrapped commands - alias cat="exec_scmb_expand_args /bin/cat" + alias cat="exec_scmb_expand_args $(which cat)" # Run shortcut wrapping source "$scmbDir/lib/git/shell_shortcuts.sh" @@ -59,11 +59,11 @@ assertAliasEquals(){ #----------------------------------------------------------------------------- test_shell_command_wrapping() { - assertAliasEquals "exec_scmb_expand_args /bin/rm --option" "rm" - assertAliasEquals "exec_scmb_expand_args nocorrect /bin/mv" "mv" - assertAliasEquals "exec_scmb_expand_args /bin/sed" "sed" - assertAliasEquals "exec_scmb_expand_args /bin/cat" "cat" - assertAliasEquals "exec_scmb_expand_args builtin cd" "cd" + assertAliasEquals "exec_scmb_expand_args $(which rm) --option" "rm" + assertAliasEquals "exec_scmb_expand_args nocorrect $(which mv)" "mv" + assertAliasEquals "exec_scmb_expand_args $(which sed)" "sed" + assertAliasEquals "exec_scmb_expand_args $(which cat)" "cat" + assertAliasEquals "exec_scmb_expand_args builtin cd" "cd" assertIncludes "$(declare -f ln)" "ln ()" assertIncludes "$(declare -f ln)" "exec_scmb_expand_args __original_ln" } From 39f659686146eb7882af2f48b9ac76ffbee0ad27 Mon Sep 17 00:00:00 2001 From: Martino Visintin Date: Sun, 12 Feb 2017 20:43:00 +0000 Subject: [PATCH 4/9] fix bin path testing --- test/lib/git/shell_shortcuts_test.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/lib/git/shell_shortcuts_test.sh b/test/lib/git/shell_shortcuts_test.sh index 522b586..b4664f3 100755 --- a/test/lib/git/shell_shortcuts_test.sh +++ b/test/lib/git/shell_shortcuts_test.sh @@ -33,11 +33,15 @@ oneTimeSetUp() { # Test functions function ln() { ln $@; } # Test aliases - alias mv="nocorrect $(which mv)" - alias rm="$(which rm) --option" - alias sed="$(which sed)" + export mv_path="$(which mv)" + export rm_path="$(which rm)" + 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 - alias cat="exec_scmb_expand_args $(which cat)" + alias cat="exec_scmb_expand_args $cat_path" # Run shortcut wrapping source "$scmbDir/lib/git/shell_shortcuts.sh" @@ -59,10 +63,10 @@ assertAliasEquals(){ #----------------------------------------------------------------------------- test_shell_command_wrapping() { - assertAliasEquals "exec_scmb_expand_args $(which rm) --option" "rm" - assertAliasEquals "exec_scmb_expand_args nocorrect $(which mv)" "mv" - assertAliasEquals "exec_scmb_expand_args $(which sed)" "sed" - assertAliasEquals "exec_scmb_expand_args $(which cat)" "cat" + assertAliasEquals "exec_scmb_expand_args $rm_path --option" "rm" + assertAliasEquals "exec_scmb_expand_args nocorrect $mv_path" "mv" + assertAliasEquals "exec_scmb_expand_args $sed_path" "sed" + assertAliasEquals "exec_scmb_expand_args $cat_path" "cat" assertAliasEquals "exec_scmb_expand_args builtin cd" "cd" assertIncludes "$(declare -f ln)" "ln ()" assertIncludes "$(declare -f ln)" "exec_scmb_expand_args __original_ln" From 67458229530e66b0223ffeb99e55e3a44c64b77f Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sun, 19 Feb 2017 20:05:59 +0700 Subject: [PATCH 5/9] Fix IFS issues - have to always unset after use --- lib/design.sh | 1 + lib/git/branch_shortcuts.sh | 1 + lib/git/fallback/status_shortcuts_shell.sh | 2 +- lib/git/repo_index.sh | 12 ++++++------ lib/git/shell_shortcuts.sh | 8 ++++---- lib/git/status_shortcuts.sh | 6 +++--- test/lib/git/repo_index_test.sh | 4 ++-- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/design.sh b/lib/design.sh index 5106247..e0e2091 100644 --- a/lib/design.sh +++ b/lib/design.sh @@ -102,5 +102,6 @@ design() { printf "Invalid command.\n\n" design fi + unset IFS } diff --git a/lib/git/branch_shortcuts.sh b/lib/git/branch_shortcuts.sh index ddea8dc..61012e2 100644 --- a/lib/git/branch_shortcuts.sh +++ b/lib/git/branch_shortcuts.sh @@ -39,6 +39,7 @@ EOF if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi let e++ done + unset IFS } __git_alias "$git_branch_alias" "_scmb_git_branch_shortcuts" "" diff --git a/lib/git/fallback/status_shortcuts_shell.sh b/lib/git/fallback/status_shortcuts_shell.sh index e7cce4b..9368588 100755 --- a/lib/git/fallback/status_shortcuts_shell.sh +++ b/lib/git/fallback/status_shortcuts_shell.sh @@ -114,7 +114,7 @@ git_status_shortcuts() { # so just use plain 'git status' git status fi - IFS=$' \t\n' + unset IFS zsh_reset # Reset zsh environment to default } # Template function for 'git_status_shortcuts'. diff --git a/lib/git/repo_index.sh b/lib/git/repo_index.sh index c77d115..b197d49 100644 --- a/lib/git/repo_index.sh +++ b/lib/git/repo_index.sh @@ -116,7 +116,7 @@ function git_index() { fi fi fi - IFS=$' \t\n' + unset IFS } _git_index_dirs_without_home() { @@ -131,7 +131,7 @@ function _find_git_repos() { echo ${repo%/.git} # Return project folder, with trailing ':' _find_git_submodules $repo # Detect any submodules done - IFS=$' \t\n' + unset IFS } # 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 echo $(basename $repo | sed "s/ /_/g") $repo done | sort | cut -d " " -f2- >| "$GIT_REPO_DIR/.git_index" - IFS=$' \t\n' + unset IFS if [ "$1" != "--silent" ]; then 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." fi done - IFS=$' \t\n' + unset IFS # Update all remotes if there are any branches to update if [ -n "${branches[*]}" ]; then git fetch --all 2> /dev/null; fi @@ -268,7 +268,7 @@ function _git_index_batch_cmd() { cwd="$PWD" if [ -n "$1" ]; then echo -e "== Running command for $_bld_col$(_git_index_count)$_txt_col repos...\n" - IFS=$' \t\n' + unset IFS local base_path for base_path in $(sed -e "s/--.*//" "$GIT_REPO_DIR/.git_index" | \grep . | sort); do builtin cd "$base_path" @@ -313,7 +313,7 @@ if [ $shell = 'bash' ]; then else COMPREPLY=($(compgen -W '$(sed -e "s:.*/::" -e "s:$:/:" "$GIT_REPO_DIR/.git_index" | sort)' -- $curw)) fi - IFS=$' \t\n' + unset IFS return 0 } else diff --git a/lib/git/shell_shortcuts.sh b/lib/git/shell_shortcuts.sh index 26a9ff4..6299537 100644 --- a/lib/git/shell_shortcuts.sh +++ b/lib/git/shell_shortcuts.sh @@ -125,11 +125,11 @@ if [ "$shell_ls_aliases_enabled" = "true" ] && which ruby > /dev/null 2>&1; then fi # Parse path from args - OLDIFS="$IFS"; IFS=$'\n' + IFS=$'\n' for arg in $@; do if [ -d "$arg" ]; then local rel_path="${arg%/}"; fi done - IFS="$OLDIFS" + unset IFS # 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 @@ -175,14 +175,14 @@ EOF ll_files="$(\ls "$@")" fi - OLDIFS="$IFS"; IFS=$'\n' + IFS=$'\n' for file in $ll_files; do if [ -n "$rel_path" ]; then file="$rel_path/$file"; fi export $git_env_char$e="$(eval $_abs_path_command \"${file//\"/\\\"}\")" if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi let e++ done - IFS="$OLDIFS" + unset IFS # Turn off shwordsplit unless it was on previously if [[ $shell == "zsh" ]] && [ -z "$SHWORDSPLIT_ON" ]; then unsetopt shwordsplit; fi diff --git a/lib/git/status_shortcuts.sh b/lib/git/status_shortcuts.sh index a2e20e4..d63bb0c 100644 --- a/lib/git/status_shortcuts.sh +++ b/lib/git/status_shortcuts.sh @@ -43,7 +43,7 @@ git_status_shortcuts() { if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi let e++ done - IFS=$' \t\n' + unset IFS if [ "${scmbDebug:-}" = "true" ]; then echo "------------------------"; fi # Print status @@ -91,7 +91,7 @@ git_silent_add_shortcuts() { echo -e "# Added '$file'" fi done - IFS=$' \t\n' + unset IFS echo "#" fi } @@ -186,7 +186,7 @@ _git_resolve_merge_conflict() { git add "$file" echo -e "# Added $1 version of '$file'" done - IFS=$' \t\n' + unset IFS echo -e "# -- If you have finished resolving conflicts, commit the resolutions with 'git commit'" fi } diff --git a/test/lib/git/repo_index_test.sh b/test/lib/git/repo_index_test.sh index d2afa8e..f7006ed 100755 --- a/test/lib/git/repo_index_test.sh +++ b/test/lib/git/repo_index_test.sh @@ -63,7 +63,7 @@ EOF for dir in $GIT_REPOS; do mkdir -p $dir; cd $dir; git init; done - IFS=$' \t\n' + unset IFS verboseGitCommands @@ -74,7 +74,7 @@ oneTimeTearDown() { rm -rf "${GIT_REPO_DIR}" IFS=":" for dir in $GIT_REPOS; do rm -rf $dir; done - IFS=$' \t\n' + unset IFS } ensureIndex() { From cd6f7d8640222b78655577d523a9090dbd42c21f Mon Sep 17 00:00:00 2001 From: Benjamin Polge Date: Fri, 29 Jul 2016 15:47:52 -0400 Subject: [PATCH 6/9] plugin-ified scm_breeze --- scm_breeze.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scm_breeze.plugin.zsh diff --git a/scm_breeze.plugin.zsh b/scm_breeze.plugin.zsh new file mode 100644 index 0000000..dbd6a0a --- /dev/null +++ b/scm_breeze.plugin.zsh @@ -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" + + From 65df76ebe4b3e587924b172c1cf9713732973d17 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 6 May 2017 23:13:45 +0700 Subject: [PATCH 7/9] Fixed key binding --- lib/git/keybindings.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git/keybindings.sh b/lib/git/keybindings.sh index 4ea46c3..8ec4066 100644 --- a/lib/git/keybindings.sh +++ b/lib/git/keybindings.sh @@ -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" else _bind "$git_commit_all_keys" "\" git_commit_all\n\"" - _bind "$git_add_and_commit_keys" "\"\033[1~ git_add_and_commit \n\"" - _bind "$git_commit_all_with_ci_skip_keys" "\"\033[1~ APPEND='[ci skip]' git_commit_all \n\"" + _bind "$git_add_and_commit_keys" "\"\C-A git_add_and_commit \n\"" + _bind "$git_commit_all_with_ci_skip_keys" "\"\C-A APPEND='[ci skip]' git_commit_all \n\"" fi fi From 2ef2fdc77a96dc97d2f5ed0d60e31ef882a64659 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Mon, 25 Sep 2017 17:53:40 +0700 Subject: [PATCH 8/9] Remove maintainer message, made a little logo --- README.markdown | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 28e9643..02f7523 100644 --- a/README.markdown +++ b/README.markdown @@ -1,8 +1,4 @@ -# Now looking for help with maintainance. - -## 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) From a59ace0f297402031d3a47b1b59f9bf8c776a822 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Tue, 26 Sep 2017 02:47:48 +0700 Subject: [PATCH 9/9] Changed logo --- README.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 02f7523..936281e 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,6 @@ - + + + # SCM Breeze [![TravisCI](https://secure.travis-ci.org/scmbreeze/scm_breeze.png?branch=master)](http://travis-ci.org/scmbreeze/scm_breeze)