Skip to content

Commit

Permalink
Fix incremental indexing on save (thanks @humeniuc!).
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovicchabant committed Feb 20, 2016
1 parent 9e427f4 commit 737279a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions plat/unix/update_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ echo $$ > "$TAGS_FILE.lock"
# Remove lock and temp file if script is stopped unexpectedly.
trap "errorcode=$?; rm -f \"$TAGS_FILE.lock\" \"$TAGS_FILE.temp\"; exit $errorcode" INT TERM EXIT

INDEX_WHOLE_PROJECT=1
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"
CTAGS_ARGS="$CTAGS_ARGS --append \"$UPDATED_SOURCE\""
INDEX_WHOLE_PROJECT=0
fi
fi
if [ $INDEX_WHOLE_PROJECT -eq 1 ]; then
CTAGS_ARGS="$CTAGS_ARGS \"$PROJECT_ROOT\""
fi

echo "Running ctags"
echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS \"$PROJECT_ROOT\""
$CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS "$PROJECT_ROOT"
echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS"
$CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS

echo "Replacing tags file"
echo "mv -f \"$TAGS_FILE.temp\" \"$TAGS_FILE\""
Expand Down
9 changes: 7 additions & 2 deletions plat/win32/update_tags.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,23 @@ if [%LOG_FILE%]==[] set LOG_FILE=CON
echo Locking tags file... > %LOG_FILE%
echo locked > "%TAGS_FILE%.lock"

set INDEX_WHOLE_PROJECT=1
if exist "%TAGS_FILE%" (
if not ["%UPDATED_SOURCE%"]==[""] (
echo Removing references to: %UPDATED_SOURCE% >> %LOG_FILE%
echo type "%TAGS_FILE%" ^| findstr /V /C:"%UPDATED_SOURCE%" ^> "%TAGS_FILE%.temp" >> %LOG_FILE%
findstr /V /C:"%UPDATED_SOURCE%" "%TAGS_FILE%" > "%TAGS_FILE%.temp"
set CTAGS_ARGS=%CTAGS_ARGS% --append "%UPDATED_SOURCE%"
set INDEX_WHOLE_PROJECT=0
)
)
if ["%INDEX_WHOLE_PROJECT%"]==["1"] (
set CTAGS_ARGS=%CTAGS_ARGS% "%PROJECT_ROOT%"
)

echo Running ctags >> %LOG_FILE%
echo call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE%
call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% "%PROJECT_ROOT%" >> %LOG_FILE% 2>&1
echo call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% >> %LOG_FILE%
call "%CTAGS_EXE%" -f "%TAGS_FILE%.temp" %CTAGS_ARGS% >> %LOG_FILE% 2>&1
if ERRORLEVEL 1 (
echo ERROR: Ctags executable returned non-zero code. >> %LOG_FILE%
goto :Unlock
Expand Down

0 comments on commit 737279a

Please sign in to comment.