Skip to content

Commit

Permalink
build: don't format deleted files
Browse files Browse the repository at this point in the history
Trying to format deleted files will otherwise throw an error.
  • Loading branch information
dundargoc authored May 18, 2023
1 parent 826b952 commit 24b60b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmake/Format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 24b60b0

Please sign in to comment.