aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-branch-list5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-branch-list b/git-branch-list
index 2569dc0..bd85160 100755
--- a/git-branch-list
+++ b/git-branch-list
@@ -23,10 +23,13 @@ function save_branch () {
# # echo "$branch" >> "$DATABASE"
+ if fgrep "$branch" "$DATABASE" > /dev/null; then
+ return 1
+ fi
+
cat <(echo "$branch") "$DATABASE" > "${DATABASE}.bak"
mv "${DATABASE}.bak" "$DATABASE"
- # TODO: don't save if already added
# TODO: append instead of prepend so IDs stay the same. Maybe?
}