Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get imported objects in pre-commit hook #8334

Open
itaiad200 opened this issue Nov 3, 2024 · 0 comments
Open

Unable to get imported objects in pre-commit hook #8334

itaiad200 opened this issue Nov 3, 2024 · 0 comments
Labels

Comments

@itaiad200
Copy link
Contributor

The import operation is performed using a commit, which allows it to integrate with both pre-commit and post-commit hooks. However, in pre-commit hooks, it is not possible to iterate over the objects introduced as part of the import.

Options I tried:

  • diff_refs(repository_id, left_reference_id, right_reference_id, ..): This returns an object-wise diff between left_reference_id and right_reference_id. However, in the pre-commit event, the commit ID for the import is not available.
    • A potential quick fix would be to modify the event to also pass the commit ID. However, this would introduce a discrepancy in the pre-commit event between Commit and Import operations, which may not be ideal since a commit does not exist before it is actually created.
  • diff_branch(repository_id, branch_id, ..): This returns an object-wise diff of uncommitted changes on branch_id. However, unlike with the Commit operation, there are no uncommitted objects in the branch when using Import.
@talSofer talSofer added the P2 label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants