Show 20 quoted lines
> As the quoted comment mentions, we'd ideally refactor the code to not
> set up `gitdir` with an invalid value in the first place, but that may
> be a bigger undertaking. Instead, refactor the code to use the ref
> storage format as an indicator of whether or not the ref store has been
> set up to fix the bug.
>
> Reported-by: Ronan Pigott <ronan@rjp.ie>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> ...
> - const char *refname = (!data->repo || !data->repo->gitdir) ?
> - NULL : refs_resolve_ref_unsafe(get_main_ref_store(data->repo),
> - "HEAD", 0, NULL, &flags);
> - const char *shortname;
> + const char *refname, *shortname;
>
> - if (!refname || !(flags & REF_ISSYMREF) ||
> - !skip_prefix(refname, "refs/heads/", &shortname))
> + if (!data->repo || data->repo->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> + return 0;