aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-19 23:17:22 +0200
committerTeddy Wing2018-04-19 23:33:10 +0200
commit92b7edb0d84ac0109f28da57fccf4a9d87896b1e (patch)
treecc805e1ae97049a3f8eab1c04938121df84e3c10
parent7bb9292f60c8889b2a3529748679025d73e9d645 (diff)
downloadgit-branch-list-92b7edb0d84ac0109f28da57fccf4a9d87896b1e.tar.bz2
git-branch-list(save): Allow saving branches with similar names
It wasn't possible to save branches with similar names before: $ git branch-list save a-branch-with-suffix $ git branch-list save a-branch #=> Errors $ git branch-list 1 a-branch-with-suffix This is because I wasn't matching against the whole line, so partial matches would set off the condition and exit. Use grep's `--line-regexp` flag to match against whole lines. Thanks to John Kugelman for the flag: https://stackoverflow.com/questions/4709912/how-to-make-grep-only-match-if-the-entire-line-matches/4709925#4709925
-rwxr-xr-xgit-branch-list2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-branch-list b/git-branch-list
index cde44f2..75167a3 100755
--- a/git-branch-list
+++ b/git-branch-list
@@ -44,7 +44,7 @@ __EOF__
function save_branch () {
local branch=$(branch_or_current_branch "$1")
- if fgrep "$branch" "$DATABASE" > /dev/null; then
+ if fgrep --line-regexp "$branch" "$DATABASE" > /dev/null; then
return 1
fi