diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
commit | c324271b99eee4c621463f368914d57cd729bd9c (patch) | |
tree | 5d979d333a2d5f9c080991d5482fd5916f8579c6 /cmake/Format.cmake | |
parent | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff) | |
parent | ade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff) | |
download | rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2 rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'cmake/Format.cmake')
-rw-r--r-- | cmake/Format.cmake | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/cmake/Format.cmake b/cmake/Format.cmake deleted file mode 100644 index 7097e5766f..0000000000 --- a/cmake/Format.cmake +++ /dev/null @@ -1,65 +0,0 @@ -# Returns a list of all files that has been changed in current branch compared -# to master branch. This includes unstaged, staged and committed files. -function(get_changed_files outvar) - execute_process( - COMMAND git branch --show-current - OUTPUT_VARIABLE current_branch - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process( - COMMAND git merge-base master HEAD - OUTPUT_VARIABLE ancestor_commit - OUTPUT_STRIP_TRAILING_WHITESPACE) - - # Changed files that have been committed - execute_process( - COMMAND git diff --diff-filter=d --name-only ${ancestor_commit}...${current_branch} - OUTPUT_VARIABLE committed_files - OUTPUT_STRIP_TRAILING_WHITESPACE) - separate_arguments(committed_files NATIVE_COMMAND ${committed_files}) - - # Unstaged files - execute_process( - COMMAND git diff --diff-filter=d --name-only - OUTPUT_VARIABLE unstaged_files - OUTPUT_STRIP_TRAILING_WHITESPACE) - separate_arguments(unstaged_files NATIVE_COMMAND ${unstaged_files}) - - # Staged files - execute_process( - COMMAND git diff --diff-filter=d --cached --name-only - OUTPUT_VARIABLE staged_files - OUTPUT_STRIP_TRAILING_WHITESPACE) - separate_arguments(staged_files NATIVE_COMMAND ${staged_files}) - - set(files ${committed_files} ${unstaged_files} ${staged_files}) - list(REMOVE_DUPLICATES files) - - set(${outvar} "${files}" PARENT_SCOPE) -endfunction() - -get_changed_files(changed_files) - -if(LANG STREQUAL c) - list(FILTER changed_files INCLUDE REGEX "\\.[ch]$") - list(FILTER changed_files INCLUDE REGEX "^src/nvim/") - - if(changed_files) - if(FORMAT_PRG) - execute_process(COMMAND ${FORMAT_PRG} -c "src/uncrustify.cfg" --replace --no-backup ${changed_files}) - else() - message(STATUS "Uncrustify not found. Skip formatting C files.") - endif() - endif() -elseif(LANG STREQUAL lua) - list(FILTER changed_files INCLUDE REGEX "\\.lua$") - list(FILTER changed_files INCLUDE REGEX "^runtime/") - - if(changed_files) - if(FORMAT_PRG) - execute_process(COMMAND ${FORMAT_PRG} ${changed_files}) - else() - message(STATUS "Stylua not found. Skip formatting lua files.") - endif() - endif() -endif() |