sha1_file: refactor has_sha1_file_with_flags