Fix add/remove with spaces/special characters
This commit is contained in:
@@ -23,14 +23,16 @@ if [ -n "${ZSH_VERSION:-}" ]; then shell="zsh"; SHUNIT_PARENT=$0; setopt shwords
|
||||
# Setup and tear down
|
||||
#-----------------------------------------------------------------------------
|
||||
oneTimeSetUp() {
|
||||
GIT_REPO_DIR=$(mktemp -d)
|
||||
GIT_REPO_DIR=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
||||
GIT_REPOS="/tmp/test_repo_1:/tmp/test_repo_11"
|
||||
git_status_command="git status"
|
||||
|
||||
git_index_file="$GIT_REPO_DIR/.git_index"
|
||||
|
||||
silentGitCommands
|
||||
|
||||
|
||||
echo "Using repo dir $GIT_REPO_DIR"
|
||||
|
||||
cd $GIT_REPO_DIR
|
||||
# Setup test repos in temp repo dir
|
||||
for repo in github bitbucket source_forge; do
|
||||
@@ -91,7 +93,7 @@ index_no_newlines() {
|
||||
|
||||
test_repo_index_command() {
|
||||
git_index --rebuild > /dev/null
|
||||
|
||||
|
||||
# Test that all repos are detected, and sorted alphabetically
|
||||
assertIncludes "$(index_no_newlines)" "bitbucket.*\
|
||||
blue_submodule.*\
|
||||
|
||||
@@ -28,7 +28,7 @@ oneTimeSetUp() {
|
||||
export gs_max_changes="20"
|
||||
export ga_auto_remove="yes"
|
||||
|
||||
testRepo=$(mktemp -d)
|
||||
testRepo=$(mktemp -d -t scm_breeze.XXXXXXXXXX)
|
||||
}
|
||||
|
||||
oneTimeTearDown() {
|
||||
@@ -55,8 +55,8 @@ test_git_expand_args() {
|
||||
assertEquals "$error" "seven two three four five one" "$(git_expand_args seven 2..5 1)"
|
||||
|
||||
# Test that any args with spaces remain quoted
|
||||
assertEquals "$error" "-m \"Test Commit Message\" one" "$(git_expand_args -m \"Test Commit Message\" 1)"
|
||||
assertEquals "$error" "-ma \"Test Commit Message\" Unquoted"\
|
||||
assertEquals "$error" "-m Test\ Commit\ Message one" "$(git_expand_args -m "Test Commit Message" 1)"
|
||||
assertEquals "$error" "-ma Test\ Commit\ Message Unquoted"\
|
||||
"$(git_expand_args -ma "Test Commit Message" "Unquoted")"
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ test_git_status_shortcuts() {
|
||||
assertNotIncludes "$git_status3" "Untracked files"
|
||||
|
||||
# Run command in shell, load output from temp file into variable
|
||||
temp_file=$(mktemp)
|
||||
temp_file=$(mktemp -t scm_breeze.XXXXXXXXXX)
|
||||
git_status_shortcuts > $temp_file
|
||||
git_status=$(cat $temp_file | strip_colors)
|
||||
|
||||
@@ -232,7 +232,7 @@ test_git_commit_prompt() {
|
||||
commit_msg="\"Nathan's git commit prompt function!\""
|
||||
dbl_escaped_msg="\\\\\"Nathan's git commit prompt function\"'"'!'"'\"\\\\\""
|
||||
# Create temporary history file
|
||||
HISTFILE=$(mktemp)
|
||||
HISTFILE=$(mktemp -t scm_breeze.XXXXXXXXXX)
|
||||
HISTFILESIZE=1000
|
||||
HISTSIZE=1000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user