From 1ae0e2a11fdf8b629d020c39b8dd8e481ece12d4 Mon Sep 17 00:00:00 2001 From: Chris Blackburn Date: Sat, 21 Aug 2021 12:36:46 -0400 Subject: [PATCH] Actually use the log file, fixed bad update grep For many projects, I have tag files already generated, so I'd like to just update those. However, I noticed that gutentags would only update tag files it generated. The grep command used to remove files wasn't working for some reason, so I updated it. I also updated the script to use the log file it wasn't previously using. --- plat/unix/update_tags.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plat/unix/update_tags.sh b/plat/unix/update_tags.sh index 96823a0..f12e48e 100755 --- a/plat/unix/update_tags.sh +++ b/plat/unix/update_tags.sh @@ -88,6 +88,14 @@ if [ "$1" != "" ]; then exit 1 fi +# Redirect output to log file +if [ "$LOG_FILE" != "" ]; then + exec 1<&- + exec 2<&- + exec 1<>$LOG_FILE + exec 2>&1 +fi + echo "Locking tags file..." echo $$ > "$TAGS_FILE.lock" @@ -98,8 +106,7 @@ INDEX_WHOLE_PROJECT=1 if [ -f "$TAGS_FILE" ]; then if [ "$UPDATED_SOURCE" != "" ]; then echo "Removing references to: $UPDATED_SOURCE" - tab=" " - cmd="grep --text -Ev '^[^$tab]+$tab$UPDATED_SOURCE$tab' '$TAGS_FILE' > '$TAGS_FILE.temp'" + cmd="grep --text -Ev '^[[:alnum:]_]+[[:space:]]$UPDATED_SOURCE[[:space:]]' '$TAGS_FILE' > '$TAGS_FILE.temp'" echo "$cmd" eval "$cmd" || true INDEX_WHOLE_PROJECT=0