Skip to content

Commit

Permalink
Optimize validate_sha() with --max-count=1 (#111)
Browse files Browse the repository at this point in the history
Optimize the `validate_sha()` function with `--max-count=1` to prevent
printing the git log of every single commit.

This makes the function near instant.
  • Loading branch information
aloisklink authored Jan 30, 2024
1 parent d7c3264 commit 45e0d09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def validate_sha(sha):
raises ValueError if the sha does not reference a commit within the repo
"""
cmd = ["git", "log", "-r", sha]
cmd = ["git", "log", "--max-count=1", "-r", sha]
try:
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.SubprocessError:
Expand Down

0 comments on commit 45e0d09

Please sign in to comment.