changeset 125:e1f787e8d77c

Make pattern for removal of existing lines more specific Explicitly match the file name in the second tab-delimited column. Also, add a "|| true" to handle the case where no lines would be selected by grep (e.g. after `touch tags` and only updating a single file).
author Daniel Hahler <git@thequod.de>
date Wed, 06 Apr 2016 16:09:39 +0200
parents df3b0ca48013
children 860558b2f9e8
files plat/unix/update_tags.sh
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plat/unix/update_tags.sh	Fri Mar 25 20:41:38 2016 -0700
+++ b/plat/unix/update_tags.sh	Wed Apr 06 16:09:39 2016 +0200
@@ -73,8 +73,10 @@
 if [ -f "$TAGS_FILE" ]; then
     if [ "$UPDATED_SOURCE" != "" ]; then
         echo "Removing references to: $UPDATED_SOURCE"
-        echo "grep -v \"$UPDATED_SOURCE\" \"$TAGS_FILE\" > \"$TAGS_FILE.temp\""
-        grep -v "$UPDATED_SOURCE" "$TAGS_FILE" > "$TAGS_FILE.temp"
+        tab="	"
+        cmd="grep -Ev '^[^$tab]+$tab$UPDATED_SOURCE$tab' '$TAGS_FILE' > '$TAGS_FILE.temp'"
+        echo "$cmd"
+        eval "$cmd" || true
         INDEX_WHOLE_PROJECT=0
     fi
 fi