This follows the structure and logic of find_header() in git/apply.c. Calls to helper functions are currently stubbed.