Unable to get imported objects in pre-commit hook
itaiad200 opened this issue · 0 comments
itaiad200 commented
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 betweenleft_reference_id
andright_reference_id
. However, in thepre-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 betweenCommit
andImport
operations, which may not be ideal since a commit does not exist before it is actually created.
- A potential quick fix would be to modify the event to also pass the commit ID. However, this would introduce a discrepancy in the
diff_branch(repository_id, branch_id, ..)
: This returns an object-wise diff of uncommitted changes onbranch_id
. However, unlike with theCommit
operation, there are no uncommitted objects in the branch when using Import.