Skip to content

[Code Indexer] Set from_sha as NullTree Sha instead of empty string if force_push=true

Context

From #568836 (comment 2742782759):

Gitlab::Elastic::Indexer never sets from_sha to "", if purge_unreachable_commits_from_index? is true, it sets it to empty_tree_id. This results in an additional call to gitaly getDefaultSHAFromHash in the indexer. Should we replicate the same logic in Ai::ActiveContext::Code::Indexer?

Proposal

In Ai::ActiveContext::Code::Indexer#determine_shas_and_force_reindex_flag, use the NullTree Sha (empty_tree_id) if force_push? = true.

Edited by Pam Artiaga