Skip to content

Commit

Permalink
Filter out deleted paths from files_to_lint in the pre-push hook (#38)
Browse files Browse the repository at this point in the history
## Summary:
I'm a little wary about changing this as I have never personally used it (I deleted all git hooks shortly after cloning webapp the first time),
but this feels like a minimally invasive change.

Issue: https://khanacademy.atlassian.net/browse/FEI-3574

## Test plan:
🤞

Author: jaredly

Reviewers: kevinbarabash, somewhatabstract

Required Reviewers: 

Approved by: kevinbarabash, somewhatabstract

Checks: 

Pull request URL: #38
  • Loading branch information
jaredly authored Aug 5, 2021
1 parent 8cb70d4 commit ea7872b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion githook.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def pre_push_hook(_unused_arg_remote_name, _unused_arg_remote_location):

# Parse files to lint: split at NUL characters, remove blank entries,
# and remove duplicates.
files_to_lint = list({f for f in files_to_lint.split('\0') if f})
files_to_lint = list({f for f in files_to_lint.split('\0')
if f and os.path.exists(f)})

# Lint the files, if any. If there are any errors, print a helpful
# message, and return a nonzero status code to abort the push.
Expand Down

0 comments on commit ea7872b

Please sign in to comment.