Bugfix to avoid errors due to Git subcommands returning ANSI color output.
diff --git a/git-flow-feature b/git-flow-feature
index 2fdba25..872e0bb 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -74,7 +74,7 @@
warn ""
exit 0
fi
- current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
+ current_branch=$(git branch --color=never | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$feature_branches" | sed "s ^$PREFIX g")
# determine column width first
diff --git a/git-flow-hotfix b/git-flow-hotfix
index 390e537..d214262 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -69,7 +69,7 @@
warn ""
exit 0
fi
- current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
+ current_branch=$(git branch --color=never | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$hotfix_branches" | sed "s ^$PREFIX g")
# determine column width first
@@ -137,7 +137,7 @@
}
require_base_is_on_master() {
- if ! git branch --contains "$BASE" 2>/dev/null \
+ if ! git branch --color=never --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$MASTER_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'."
diff --git a/git-flow-release b/git-flow-release
index b998673..443dd40 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -70,7 +70,7 @@
exit 0
fi
- current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
+ current_branch=$(git branch --color=never | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$release_branches" | sed "s ^$PREFIX g")
# determine column width first
@@ -132,7 +132,7 @@
}
require_base_is_on_develop() {
- if ! git branch --contains "$BASE" 2>/dev/null \
+ if ! git branch --color=never --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$DEVELOP_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
diff --git a/git-flow-support b/git-flow-support
index ba92cb9..e95dfcb 100644
--- a/git-flow-support
+++ b/git-flow-support
@@ -71,7 +71,7 @@
warn ""
exit 0
fi
- current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
+ current_branch=$(git branch --color=never | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$support_branches" | sed "s ^$PREFIX g")
# determine column width first
@@ -148,7 +148,7 @@
}
require_base_is_on_master() {
- if ! git branch --contains "$BASE" 2>/dev/null \
+ if ! git branch --color=never --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| grep -q "^$MASTER_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$MASTER_BRANCH'."
diff --git a/gitflow-common b/gitflow-common
index 29ef388..f30cd5f 100644
--- a/gitflow-common
+++ b/gitflow-common
@@ -66,13 +66,13 @@
# Git specific common functionality
#
-git_local_branches() { git branch | sed 's/^[* ] //'; }
-git_remote_branches() { git branch -r | sed 's/^[* ] //'; }
-git_all_branches() { ( git branch; git branch -r) | sed 's/^[* ] //'; }
+git_local_branches() { git branch --color=never | sed 's/^[* ] //'; }
+git_remote_branches() { git branch -r --color=never | sed 's/^[* ] //'; }
+git_all_branches() { ( git branch --color=never; git branch -r --color=never) | sed 's/^[* ] //'; }
git_all_tags() { git tag; }
git_current_branch() {
- git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'
+ git branch --color=never | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g'
}
git_is_clean_working_tree() {
@@ -140,7 +140,7 @@
git_is_branch_merged_into() {
local subject=$1
local base=$2
- local all_merges=$(git branch --contains $subject | sed 's/^[* ] //')
+ local all_merges=$(git branch --color=never --contains $subject | sed 's/^[* ] //')
has $base $all_merges
}