From 24b60b0f71e0ffbd09c827230ecb5a37e833cade Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 18 May 2023 16:28:46 +0200 Subject: build: don't format deleted files Trying to format deleted files will otherwise throw an error. --- cmake/Format.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmake/Format.cmake') diff --git a/cmake/Format.cmake b/cmake/Format.cmake index 4115e66705..7e8ca3547d 100644 --- a/cmake/Format.cmake +++ b/cmake/Format.cmake @@ -15,21 +15,21 @@ function(get_changed_files outvar) # Changed files that have been committed execute_process( - COMMAND git diff --name-only ${ancestor_commit}...${current_branch} + 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 --name-only + 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 --cached --name-only + 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}) -- cgit From 25cfe3fd432d77689446fe5a0bb972479298387c Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 23 Oct 2023 21:03:15 +0200 Subject: build: enable formatting during rebase Closes https://github.com/neovim/neovim/issues/25654 --- cmake/Format.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'cmake/Format.cmake') diff --git a/cmake/Format.cmake b/cmake/Format.cmake index 7e8ca3547d..7097e5766f 100644 --- a/cmake/Format.cmake +++ b/cmake/Format.cmake @@ -1,15 +1,13 @@ # 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) - set(default_branch master) - execute_process( COMMAND git branch --show-current OUTPUT_VARIABLE current_branch OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( - COMMAND git merge-base ${default_branch} ${current_branch} + COMMAND git merge-base master HEAD OUTPUT_VARIABLE ancestor_commit OUTPUT_STRIP_TRAILING_WHITESPACE) -- cgit